The my $a_ = $a; step is so the values in the array aliased by the 'magical' variables $a and $b are not changed by the substitutions (i.e., the change you noted).
In reply to Re^5: How do I sort an array by hash value?
by AnomalousMonk
in thread How do I sort an array by hash value?
by josh097
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |