Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In the code below
my $code_ref = sub { my $array_ref; my $nested_code_ref = sub { my @array = ("one","two","three"); $array_ref = \@array; }; $nested_code_ref->(); return $array_ref; }; print $code_ref->()->[0]; print $code_ref->()->[1];
Is it possible to call the anonymous block referenced by $nested_code_ref outside the anonymous block $code_ref.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Nested references
by almut (Canon) on Apr 30, 2010 at 09:28 UTC | |
|
Re: Nested references
by moritz (Cardinal) on Apr 30, 2010 at 09:27 UTC |