in reply to Re: (jeffa) Re: (s)coping with foreach
in thread (s)coping with foreach
my $var=0; foreach ($var=1; $var < 10; ++$var){ print $var; } print "\n$var \n";
it appears that when used with a c style loop for/foreach does not localise the index variable... and for the record I have never written a loop with the index variable other than the normal syntax of for (my $var;... :-)
--
my $chainsaw = 'Perl';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (s)coping with foreach
by cLive ;-) (Prior) on Apr 02, 2001 at 07:05 UTC |