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
    > Did you get something else? If so, what?

    The OP claimed the 9 was printed.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Ah. At the time I posted all I had was the original problem statement, so I assumed the 9 was part of the Perl source.