in reply to Unexpected chomp behavior

my @due=sort chomp (my @lines=<STDIN>);
is basically
my @anon = chomp (my @lines=<STDIN>); my @due=sort @anon;
It is not the same as
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.