larsss31 has asked for the wisdom of the Perl Monks concerning the following question:
and if i wanted to sort it by its values, again obtaining a list of sorted keys:sort { $a <=> $b } keys %hash
so far, so good.sort { $hash{$a} <=> $hash{$b} } keys %hash
and if i want to sort by keys i usesort { $a <=> $b } values %hash
Am I right? If not, please tell me what's wrong.sort { $hash{$a} <=> $hash{$b} } values %hash
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sort: By keys, values, and their returning values.
by BioLion (Curate) on Nov 25, 2009 at 11:18 UTC | |
Re: Sort: By keys, values, and their returning values.
by jethro (Monsignor) on Nov 25, 2009 at 11:31 UTC | |
Re: Sort: By keys, values, and their returning values.
by salva (Canon) on Nov 25, 2009 at 11:29 UTC | |
Re: Sort: By keys, values, and their returning values.
by kyle (Abbot) on Nov 25, 2009 at 15:16 UTC | |
Perl 6 sorting (was: Re: Sort: By keys, values, and their returning values.)
by moritz (Cardinal) on Nov 26, 2009 at 10:50 UTC | |
by salva (Canon) on Nov 26, 2009 at 11:40 UTC | |
by moritz (Cardinal) on Nov 26, 2009 at 12:37 UTC | |
Re: Sort: By keys, values, and their returning values.
by Anonymous Monk on Nov 25, 2009 at 22:15 UTC |