in reply to loop control

Are you sure your first conditional is correct? The next loop control statement will go to the next iteration in the current block, which in your case is the immediate foreach loop. Here's an example of some code which works as one would expect
my @l = qw(foo bar baz quux); foreach (@l) { if(index($_, 'a') > -1) { next; } else { print $_, $/; } } __output__ foo quux
So we can see that next is being called when $_ contained an 'a'.

Also this might be a better way to loop through your list

&do_something foreach grep { (! conditionA) && conditionB } @tmp;
The grep filters out any elements that don't meet conditionA but do meet conditionB, which is basically what your example loop does.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: loop control
by Galen (Beadle) on May 22, 2002 at 17:48 UTC
    Using grep is a good suggestion, but I don't think it'd work for me in this case because the array typically consists of nested values. In other words, $tmp5 needs to be specified as a child of $tmp4 unless $tmp4 was a termination of $tmp3.... or something like that. I could design the logic to backtrack and do these checks, but it just makes more sense to parse through them one by one.