Perl: the Markov chain saw | |
PerlMonks |
Re: Using $a and $b for sortby kirillm (Friar) |
on Jan 03, 2008 at 11:48 UTC ( [id://660172]=note: print w/replies, xml ) | Need Help?? |
Sorting a hash table? Do you mean sorting keys in a hash? Or? If you have lexicalized $a and $b (with my), you won't be able to use them in sort in the same or in the child block:
If you have lexicalized $a and $b in a separate block, you can use $a and $b in sort (note that both $a and $b are empty in last prints):
Please read perldoc -f sort and perlvar. I'd avoid use of $a and $b altogether.
In Section
Seekers of Perl Wisdom
|
|