note
Laurent_R
<blockquote>
<c>
Don't lexicalize them with my $a or my $b if you want to be able to use them in the sort() comparison block or function.
</c>
</blockquote>
But, on the other hand you can [perldoc://local]ize them when needed:
<c>
$ perl -we '
local $a = 1;
@h = sort {$a <=> $b} keys %hash;
print "@h\n";> %hash = map { $_ , undef } 0 .. 3;
@h = sort {$a <=> $b} keys %hash;
print "@h\n";
'
0 1 2 3
</c>
1137627
1137632