in reply to Re: How do I keep the first key in a sorted hash?
in thread How do I keep the first key in a sorted hash?
Now, depending on how you get the data in the first place, you could also maintain the $min variable when populating the hash, thereby avoiding to read all the keys once more.my $min = 1e10; for my $key (keys %h) { $min = $key if $key < $min; } # now, $min is the smallest key. The associated value is simply $h{$mi +n}
|
|---|