Hi Chris,
Use loop breaks such as last, next, goto etc
eg
@arr=qw(1 3 4 2 4 5);
foreach $number(@arr) {
last if($number == 2);
print "$number";
}
HTH
Regards
Babylakshmi M
_
Get your FREE download of MSN Explorer at http://
> Can someone tell me how I can break out of a foreach loop before the end?
Use the 'last' command. See
http://www.perldoc.com/perl5.6/pod/func/last.html for an explanation of how
to use it. It works for breaking out of any loop e.g. foreach, while,
until.
Best wishes,
Rachel
--
To unsu
nday, August 05, 2001 7:31 PM
Subject: Breaking out of foreach loop
> Can someone tell me how I can break out of a foreach loop before the end?
>
> Thanks
>
> Chris
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PR
Can someone tell me how I can break out of a foreach loop before the end?
Thanks
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Sorry if this is a repost. Sent it from wrong address.
Can someone tell me how I can break out of a foreach loop before the end?
Thanks
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]