in reply to How to retrieve the worst value?
Turn the hash inside-out, then sort the keys in descending order and pick the first.
my %hash = (processone => 1, processtwo => 0.005, processthree => 3) +; my %hash2 = map {$hash{$_} => $_} keys %hash; my $worst = (reverse sort keys %hash2)[0]; print "the worst process is $hash2{$worst} with a time of $worst min +utes\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to retrieve the worst value?
by halley (Prior) on Apr 01, 2004 at 16:07 UTC | |
|
Re: Re: How to retrieve the worst value?
by mce (Curate) on Apr 01, 2004 at 14:13 UTC |