http://www.perlmonks.org?node_id=719541


in reply to Re^3: Lexical closures
in thread Lexical closures

I invariably write:

for my $i (0..3) {

so I am reminded of the scope of the loop variable and am not tempted to think of it having larger scope.

A very good rule to follow is to always declare lexical variables in the smallest scope possible which precludes declaring declaring loop variables outside the for loop scope


Perl reduces RSI - it saves typing