in reply to Re: using next in a nested foreach()
in thread using next in a nested foreach()

This solution, of course, doesn't help with existing deeply nested loops. That's where the labels come in really handy. There is the caveat that the misuse of labels can cause very odd behavior (like the sudden termination of you script) if you are not careful (typos).

Also, to further optimize (typing optimization; not necessarily execution optimization) based on japhy's comment, you could try this instead:

push @results, grep { grep { $1 eq $_ } @two if ( $_ =~ /\(.\)(.+)\(.\)/ ) } @one;
You get to use a nested grep, but you check all values of @two and don't stop when you find a match.

Update: Since grep will localize $_ and I don't need the outer $_ in the inner grep, I optimized away reassigning the outer $_;

Ivan Heffner
Sr. Software Engineer, DAS Lead
WhitePages.com, Inc.