On Aug 12, 2010, at 19:08, Kryten wrote:
> Hi,
>
> Complete newbie.
>
> Is there any way to use "next" from within a foreach loop?
>
> All the examples I have seen/read use a while loop to demo.
Yes, next will work on for/foreach, while, and until loops. So you can say
for my $num (1 .. 10)
2010/8/13 Kryten :
> Hi,
>
> Complete newbie.
>
> Is there any way to use "next" from within a foreach loop?
>
Sure.
$ perl -le '
> for (1..10) {
> next if $_ == 5;
> print;
> } '
1
2
3
4
6
7
8
9
10
--
Jeff Pang
http://home.arcor.de/pangj/
--
To unsubscribe, e-mail: beginners-unsubsc
Hi,
Complete newbie.
Is there any way to use "next" from within a foreach loop?
All the examples I have seen/read use a while loop to demo.
Thanks,
Stuart
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/