nikhil mehta
nikhil mehta

Reputation: 1032

A simle Perl code with here-document works on Linux but not on Windows

While practicing I found that the following code is working fine on Linux but not on Windows

print<<EOF;
this is a paragraph
EOF

On Windows it says.

Can't find string terminator "EOF" anywhere before EOF at demo.pl.

Upvotes: 0

Views: 121

Answers (1)

Yu Hao
Yu Hao

Reputation: 122493

Windows thinks the end of file is part of the terminating string EOF, thus it doesn't follow the rule that The terminating string must appear by itself. You need to add a new line after the terminating string EOF.

print<<EOF;
this is a paragraph
EOF
# a new line

Upvotes: 1

Related Questions