in reply to Scoping question
in an expression such as
The first $item on the line is the one you're declaring lexical while the second $item is whatever $item is available in the enclosing scope. Your lexical $item isn't available until after that statement has completely executed.my $item = $item;
Perl 6 will change this behavior and make variables available as soon as possible. In order to get the old behavior you'll need to do something like:
my $item = $OUTER::item;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scoping question
by pg (Canon) on Nov 03, 2004 at 21:00 UTC | |
by bpphillips (Friar) on Nov 03, 2004 at 21:17 UTC | |
by ihb (Deacon) on Nov 04, 2004 at 13:43 UTC |