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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Lexical closures
by ig (Vicar) on Oct 26, 2008 at 01:37 UTC | |
|
Re^5: Lexical closures
by backstab (Novice) on Oct 25, 2008 at 20:45 UTC |