找不到字符串终止符“str";EOF 之前的任何地方 [英] Can't find string terminator "str" anywhere before EOF

查看:49
本文介绍了找不到字符串终止符“str";EOF 之前的任何地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么会出现这个错误?

Why I get this error?

use strict;
use warnings;

my $str = <<str; 
88087   23/11/2010 
35192   25/07/2010 
B3J 5X9 17/08/2011 
C8U 5L6 16/08/2011 
F4Q 3B4 17/10/2010 
D3X 9P4 11/05/2010 
O7L 6Z8 28/02/2010 
W8L 9P2 05/09/2010 
str 

print $str;

my @arr = split/\n/,$str;
foreach (@arr) {
        my @tmp = split/\t/;
        print "$tmp[1]\n";
}

推荐答案

此处不应有空格:

str 
   ^

heredoc 终止符应该单独在一行上,并且不应该有任何东西(甚至空格)围绕它.

The heredoc terminator should be on a line by itself and should not have anything (not even space) surrounding it.

这篇关于找不到字符串终止符“str";EOF 之前的任何地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆