Hi All,

my @array = (1..10);
foreach my $number (@array) {
  next if $number == 5;
  print $number;
}

When $number == 5, perl exits the foreach loop completely, instead of
skipping the record and going to the next record in the array.

I am obviously missing something here, but it seems to me that 'next' is
behaving like 'last' in this example.   What would be the correct way to do
this?

--
Chris.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to