in reply to Inner subroutines?
The "inner" sub is actually visible to everyone.
$ perl -wE'sub o { sub i { say "foo"; } } i();' foo
The "inner" sub cannot use variables from the "outer" sub.
$ perl -wE'sub o { my ($x) = @_; sub i { say $x; } i(); } o("abc"); o( +"def");' Variable "$x" will not stay shared at -e line 1. abc abc
I tend to call what you have a bug, not a technique.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inner subroutines?
by bart (Canon) on Feb 11, 2011 at 16:28 UTC | |
by ikegami (Patriarch) on Feb 11, 2011 at 17:39 UTC |