What about having the sort function qualify the names, eg. $main::a, to avoid that issue?
In reply to Re: Re (tilly) 1: $a and strict by John M. Dlugosz in thread $a and strict by mce