in reply to loop control
So we can see that next is being called when $_ contained an 'a'.my @l = qw(foo bar baz quux); foreach (@l) { if(index($_, 'a') > -1) { next; } else { print $_, $/; } } __output__ foo quux
Also this might be a better way to loop through your list
The grep filters out any elements that don't meet conditionA but do meet conditionB, which is basically what your example loop does.&do_something foreach grep { (! conditionA) && conditionB } @tmp;
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: loop control
by Galen (Beadle) on May 22, 2002 at 17:48 UTC |