P is for Practical | |
PerlMonks |
Sort: By keys, values, and their returning values.by larsss31 (Acolyte) |
on Nov 25, 2009 at 11:03 UTC ( [id://809315]=perlquestion: print w/replies, xml ) | Need Help?? |
larsss31 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I have a question regarding the sort function.
Can you confirm to me that, having an hash '%hash', and wanting to sort its keys by key, hence returning a list of sorted keys (assuming a monodimensional hash, with numeric sorting), i should use:
and if i wanted to sort it by its values, again obtaining a list of sorted keys: so far, so good. Now, i want to sort my hash, but by its values, i use "values", and, to sort by value, i should use: and if i want to sort by keys i use Am I right? If not, please tell me what's wrong. If I am, there must be some problem in the last sort, because it does not return me a list of values sorted by keys, it just does simply nothing (at least, in my real code, not this fictional example). thanks in advance, larss
Back to
Seekers of Perl Wisdom
|
|