in reply to Re^2: Sort and Access Math::Currency Objects
in thread Sort and Access Array of Hash
you'll want something likemy $lowest = min values $products_and_prices;
The parentheses create list context on the assignment, so that lowest gets assigned to the first list element, which is the item that was smallest. Of course, you could write something more efficient, and I haven't tested the above because you still haven't posted useful example code.my ($lowest) = sort {$products_and_prices->{$a} <=> $products_and_pric +es->{$b}} keys $products_and_prices;
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Sort and Access Math::Currency Objects
by PerlSufi (Friar) on Aug 15, 2014 at 16:32 UTC |