in reply to Re: finding next key in db_file
in thread finding next key in db_file
Why not just hack it out with a loop?
"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"
sulfericacid
my $current = 5; my %hash = ( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five", "8" => "eight" ); while ($current) { $current++; if (exists $hash{$current}) { print "next: $hash{$current}"; last; } }
Update: solution for finding the highest num
my $highest = 0; foreach my $key (keys %hash) { if ($key > $highest) { $highest = $key; } } print "\nhighest number is: $highest";
"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"
sulfericacid
In Section
Seekers of Perl Wisdom