|
Posted by Tad J McClellan on March 9, 2008, 11:16 am
Please log in for more thread options
> I am new to perl, and I am wondering whether it is a bad thing to jump out
> of a foreach loop with return.
Yes it is a bad thing, because it will not work. :-)
> I have a function which searches for a
> value in one of several arrays. If the value is found in any of them,
> then the whole function may as well terminate.
Oh.
Using a return() to return from a subroutine is perfectly fine
(even if the return() is within a loop).
> Would it be safe / stylistically sound to do away with the flag by using
> "return" rather than "last".
Yes.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"
|