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';
In reply to Re: Re: (jeffa) Re: (s)coping with foreach
by greenFox
in thread (s)coping with foreach
by greenFox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |