Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: loop surpriseby morgon (Priest) |
on Apr 03, 2018 at 13:44 UTC ( [id://1212254]=note: print w/replies, xml ) | Need Help?? |
Ok, that explains it, but I don't quite get the rationale for doing it this way... If I wanted a localized variable I write the loop as "for my $j (...)". If I explicitly use "for $i" I make clear my intention of using a previously introduced variable. Why perl then insists on knowing better and localizing it is counter-intuitive to me and at the moment I don't see any reason why it should be implemented like that (but there probably is one)...
In Section
Seekers of Perl Wisdom
|
|