[ale] OT: one for the Perl Guru's

Fletch fletch at phydeaux.org
Wed May 7 10:21:25 EDT 2003


>>>>> "Jerry" == Jerry Yu <z.yu at voicecom.com> writes:

    Jerry> directly from perlfunc man page (switch a and b to gets
    Jerry> ascending order)
    Jerry> ------------------------------------------------------- To
    Jerry> sort a hash by value, you'll need to use a "sort" function.
    Jerry> Here's a descending numeric sort of a hash by its values:


    Jerry>    foreach $key (sort { $hash{$b} <=> $hash{$a} } keys
    Jerry> %hash)


See also:


perldoc -q 'How do I sort'


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
                      |                                               U
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list