in reply to Re: Re: "for" surprise
in thread "for" surprise

why not move everything to a function and let the function return the index where the data is found?
sub search{ my ($item,$end) = @_; my $i; my $found = 1; foreach $i (0..$end) { if (some condition on the list){ return ($found, $i); } } return (0,0); }

since perl supports multiple return values, we could return $found as well if someone wants it.