in reply to issue 'my' sub cannot work
I have tried your code under the most-recent release of every production Perl from 5.18 to 5.34, and they all produce the output I expect: Undefined subroutine &main::this called at fubar.pl line 6. This is because the 'my' restricts the scope of sub this to the interior of sub out.
Did you get something else? If so, what?
Were you expecting something else? If so, what?
Note that for some of the Perls I tried it was necessary to run the script this way:
$ perl -Mexperimental=lexical_subs fubar.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: issue 'my' sub cannot work
by LanX (Saint) on Jan 03, 2022 at 13:48 UTC | |
by Anonymous Monk on Jan 04, 2022 at 16:16 UTC |