in reply to Unexpected chomp behavior
is basicallymy @due=sort chomp (my @lines=<STDIN>);
It is not the same asmy @anon = chomp (my @lines=<STDIN>); my @due=sort @anon;
chomp (my @lines=<STDIN>); my @due=sort @lines;
In the first snippet you posted, you are sorting @lines. In the second, you are sorting the result of chomp. These are very different, as described in chomp's documentation.
|
|---|