oh it is. The problem is that you're sending a carriage return to the screen. It's probably trailing the previous element in the array.
$ perl -e'print "abc", "def
", "ghi", "
";'
ghidef
You probably read a Windows text file on a non-Windows system without convert the line endings, either in advance (using dos2unix
) or when you read the file (by using s/s+z//;
instead of chomp;
).
As jordanm suggested in a comment, the debugger's x
command will show you what you have better than p
.
$ perl -d
Loading DB routines from perl5db.pl version 1.33
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
my @a = ("abc", "def
", "ghi");
1;
^D
main::(-:1): my @a = ("abc", "def
", "ghi");
DB<1> s
main::(-:2): 1;
DB<1> p @a
ghidef
DB<2> x @a
0 'abc'
1 "defcM"
2 'ghi'
DB<3> q
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…