这是换行符的问题, 原文档应该来自 linux, 您可以写成:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@results =
chomp @results; # 加上这句
...
...
for ( 0..6 ) { # 这句送您的, 可以这样写啊! =)
print $results[$_] . $/;
}
# 或者也可以这样写啦...
for my $index ( 0..6 ) {
print $results[$index] . $/;
}
# $/ 是 perl 自动为您选择的换行符, 对应您现在用的系统来选择
# "\r", "\n" 或是 "\r\n"
# 这样您写的 script 无论放到 linux, ios, 或是 windows 都会有一样的结果