iam using perl to print some data but it is giving me error as Can't find string terminator "EOF" anywhere before EOF at
The code is:
#!/usr/local/bin/perl -w
print <<EOF;
hello
EOF
ERROR:
[Mon May 23 11:32:12 2016] [error] [client 192.168.10.117] Directory index forbidden by Options directive: /var/www/, referer: http://192.168.10.100/ [Mon May 23 11:32:12 2016] [error] [client 192.168.10.117] malformed header from script. Bad header=hello: testeof.cgi [Mon May 23 11:32:18 2016] [error] [client 192.168.10.117] Directory index forbidden by Options directive: /var/www/, referer: http://192.168.10.100/ [Mon May 23 11:32:18 2016] [error] [client 192.168.10.117] Can't find string terminator "EOF" anywhere before EOF at /var/www/sandeep/testeof.cgi line 2. [Mon May 23 11:32:18 2016] [error] [client 192.168.10.117] Premature end of script headers: testeof.cgi
I tried putting EOF in single quotes (print <<'EOF';) as shown in this answer, but the error is same. Printing by this method is working in otherr files in the same directory.
I also referred this question (Why am I getting “Can't find string terminator ”'“ anywhere before EOF at -e line 1” when I try to run a Perl one-liner on Windows?) but in that question OP is using different method to print and iam using linux(UBUNTU).
Please guide where I am doing wrong?