Use a label on your while loop:
HASH: while(my ($key, $value) = each %ids) { for my $item (@names) { if($item =~ m/$key/) { push @groups, $item; next HASH; } } }
Alternatively, you could also use last to exit the inner loop and let things take their natural course, as it were.
In reply to Re: nested loops and next
by AppleFritter
in thread nested loops and next
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |