c has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my @array = qw(one two three); &one; sub one { local $i; foreach $i(@array) { &two; } } sub two { print "$i\n"; }
when i take use strict; out of the equation, the second subroutine prints out the value of $i for each iteration of the foreach loop. however, useing strict causes perl to complain about needing a global declaration for $i. could someone explain this one to me?
humbly -c
|
|---|