Perl here-doc not working

I am trying to use here-documents , but it does not work. What could be wrong? Am I missing something?

This is all the contents of the file I'm trying to run (there are no spaces or tabs anywhere):

print<<EOF; text EOF 

I run it, saving it in notepad or notepad ++ as a file named 3.pl
then, going to the DOS window under Windows 7 and typing: perl 3.pl I get this message:

Cannot find the line terminator "EOF" anywhere before EOF on line 3.pl.

+7
source share
1 answer

Make sure your file has an empty line at the end. It should be four lines:

 print<<EOF; text EOF #or a comment here works too ;) 
+23
source

All Articles