more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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: 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. In reply to Re^2: using next in a nested foreach()
by Codon
|
|