sandrider has asked for the wisdom of the Perl Monks concerning the following question:
I have this nested foreach loop
foreach $one (@one) { foreach $two (@two) { $one =~ m/\(.\)(.+)\(.\)/; if ($two eq $1) { push @result, $one; } } }
I need the script to go to the parent foreach loop when $two eq $1, I've tried putting next in the if but it just goes to the next field in the child foreach.
Thanks.
Desmond
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using next in a nested foreach()
by gryphon (Abbot) on Aug 16, 2005 at 01:36 UTC | |
by Codon (Friar) on Aug 16, 2005 at 17:56 UTC | |
|
Re: using next in a nested foreach()
by jhourcle (Prior) on Aug 16, 2005 at 01:01 UTC | |
|
Re: using next in a nested foreach()
by GrandFather (Saint) on Aug 16, 2005 at 01:07 UTC | |
|
Re: using next in a nested foreach()
by japhy (Canon) on Aug 16, 2005 at 13:01 UTC | |
|
Re: using next in a nested foreach()
by sandrider (Acolyte) on Aug 16, 2005 at 03:15 UTC |