in reply to Possible bug in Perl?

Try renaming $a and $b to something else. Those variables are used in sort comparisons. Check out, for example, Programming Perl, 3rd Ed., p. 654.