http://www.perlmonks.org?node_id=966886


in reply to my and local variable significance in a particular case

Note that $a and $b are special variables !

See perlvar: $a $b : Special package variables when using sort(), see sort. Because of this specialness $a and $b don't need to be declared (using use vars , or our()) even when using the strict 'vars' pragma. 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.

Read documentation about local too.