in reply to compare previous and present hash key values
my @keys = sort your_sorting_routine keys %result; for my $i (0 .. $#keys - 1) { compare($result{ $keys[$i] }, $result{ $keys[$i + 1] }); }
Or, if you do not want to store the keys in an array, but retrieve them one by one:
my $previous = retrieve_key(); while (defined (my $next = retrieve_key())) { compare($result{$previous}, $result{$next}); $previous = $next; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compare previous and present hash key values
by undisputed (Initiate) on Jan 11, 2014 at 15:26 UTC | |
by choroba (Cardinal) on Jan 11, 2014 at 15:33 UTC | |
by undisputed (Initiate) on Jan 11, 2014 at 16:05 UTC |