my %hash = ( 'foo' => 1, 'bar' => 2, 'baz' => 3, ); OUTER_LOOP: foreach my $item qw(this that the_other) { print "$item:\n"; # keys %hash; # this resets the iterator while (my ($key, $value) = each %hash) { print " $key => $value\n"; if ($item eq 'that' && $key eq 'baz') { print "bailing out!\n"; next OUTER_LOOP; } } }