As a little perl newbie, I just ran into an error where I accidentally did something like (e.g. simplified):
my $i=0; for(my $i=0;$i<10; $i++) { print $i; } print $i;
From Why don't I get a warning when I override the Perl foreach control variable? I understand that this behavior is expected; I should not receive a warning if the re-announcement is not in the same area.
However, I cannot understand why this is so. Why doesn't perl issue a warning here? It seems to me that this would be a probable cause of errors and, as a rule, was not intended. Is there a common case when this is a normal programming style, so the warning will be annoying?
tengfred
source share