nop has asked for the wisdom of the Perl Monks concerning the following question:
I would have thought that these two loops would behave differently...use strict; my ($x, $y); foreach $x (1..10) { print "in loop x=$x\n"; last if ($x >= 5); } print "after loop x=$x\n"; foreach my $y (1..10) { print "in loop y=$y\n"; last if ($y >= 5); } print "after loop y=$y\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Scoping question
by chipmunk (Parson) on Dec 07, 2000 at 20:19 UTC |