strat has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I've got a problem with Activeperl Built 631 (Win2k) with a next-statement.
If I execute it like the following:
everything works fine.C:\ce3\bin>perl -w my @list = qw(0 1 2 3 4 5); foreach (@list){ next if $_ == 0; print $_, " "; } ^Z 1 2 3 4 5
But if I try the following:
C:\ce3\bin>perl -w use strict; my @list = qw(0 1 2 3 4 5); foreach (@list){ { next if $_ == 0; } print $_, " "; } ^Z 0 1 2 3 4 5
On the other hand, this works fine:
Is this a perl bug, or am I the bug?C:\ce3\bin>perl -w my @list = qw(0 1 2 3 4 5); foreach (@list){ { next if $_ == 0; print $_, " "; } } ^Z 1 2 3 4 5
The same behaviour happens with Perl 5.005_03 under Solaris.
Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: next in block in foreach-loop
by danger (Priest) on Apr 22, 2002 at 16:03 UTC | |
Re: next in block in foreach-loop
by erikharrison (Deacon) on Apr 22, 2002 at 16:07 UTC | |
Re: next in block in foreach-loop
by broquaint (Abbot) on Apr 22, 2002 at 16:04 UTC | |
Re: next in block in foreach-loop
by particle (Vicar) on Apr 22, 2002 at 16:32 UTC |
Back to
Seekers of Perl Wisdom