a,b,c,d
e,f,g,h
i,j,k,l
There is a carriage return at the end of each line. @arr1 before the chomp should like like above when printed out. However, I would expect that after the chomp that @arr1 would print like this:
a,b,c,d e,f,g,h i,j,k,l
But it doesn't, it prints like the first example. | [reply] [d/l] [select] |
There is a carriage return at the end of each line. @arr1 before the chomp should like like above when printed out.
You are splitting on newlines. Why do you expect them to still be there?
| [reply] |
>perl -wMstrict -le
"my $s = qq{a,b,c,d\ne,f,g,h\ni,j,k,l};
printf qq{$s};
printf qq{\n};
;;
my @ra = split /\n/, $s;
printf qq{@ra};
printf qq{\n};
;;
chomp @ra;
printf qq{@ra};
printf qq{\n};
"
a,b,c,d
e,f,g,h
i,j,k,l
a,b,c,d e,f,g,h i,j,k,l
a,b,c,d e,f,g,h i,j,k,l
| [reply] [d/l] [select] |