简体   繁体   English

Perl在这里 - 文件不起作用

[英]Perl here-document not working

I've been trying to use Here-documents but it's not working. 我一直在尝试使用Here-documents但它不起作用。 What might be wrong? 可能有什么问题? Am I missing something obvious? 我错过了一些明显的东西吗

This is the entire contents of the file I'm trying to run (there are no spaces, or tabs anywhere): 这是我正在尝试运行的文件的全部内容(在任何地方都没有空格或标签):

print<<EOF;
text
EOF

I'm running it by saving it in notepad or notepad++ as a file called 3.pl 我通过将它保存在记事本或记事本++中作为名为3.pl的文件来运行它
then by going into the DOS window under Windows 7 and typing: perl 3.pl I get this message: 然后进入Windows 7下的DOS窗口并键入: perl 3.pl我收到此消息:

Can't find string terminator "EOF" anywhere before EOF at 3.pl line 1. 在3.pl第1行的EOF之前的任何地方都找不到字符串终止符“EOF”。

Make sure your file has an empty line at the end. 确保您的文件末尾有一个空行。 This should be four lines: 这应该是四行:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM