#!perl -l my %hash=(1..10); sub printit { print join "\t",keys %hash; } while (my ($key, $value) = each %hash) { print "First: $key $value"; last if $value>5; } while (my ($key, $value) = each %hash) { print "Second: $key $value"; #printit; } __END__ First: 1 2 First: 3 4 First: 7 8 Second: 9 10 Second: 5 6