in reply to my $a outside sort block incompatibility

Yet another way to do it is to use a sort routine with a ($$) prototype on it.
... my $a = "whatever"; my $sort_sub = sub ($$) { $_[0] <=> $_[1] }; @arr2 = sort $sort_sub @arr1; ...
The main reason to use the ($$) prototype in a sort routine is the case where you may be defining the sort routine in one package, and then calling sort in another.