in reply to ptkdb: 'my' variable in sub retains value between calls

If you want to declare two my-variables, use either of the following:
my ($a, $b); my $a; my $b; my $a, my $b;

By the way, the usage of the variables $a and $b for something other than sort is generally frowned upon. Probably that's why strict (if you use it) did not complain that the variable $b is not declared: Because it's a special variable and it's declared internally.