我一直在尝试使用 Here-documents ,但它不起作用。可能有什么问题?我错过了一些明显的东西吗?
这是我要运行的文件的全部内容(任何地方都没有空格或制表符):
print<<EOF;
text
EOF
我通过将其保存在 Notepad 中来运行它或 Notepad++作为一个名为 3.pl 的文件。然后通过进入 Windows 7 下的 DOS 窗口
并打字
perl 3.pl
我收到这条消息:Can't find string terminator "EOF" anywhere before EOF at 3.pl line 1.
最佳答案
确保您的文件末尾有一个空行。这应该是四行:
print<<EOF;
text
EOF
#or a comment here works too ;)
关于perl - 使用 Perl here-document 导致 "Can' t 在 EOF 之前的任何位置找到字符串终止符 "EOF"”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5136710/