in reply to Re: use has it's own scope?
in thread use has it's own scope?

Thanks for RTFM for me! ;)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^3: use has it's own scope?
by Eily (Monsignor) on Sep 06, 2017 at 09:43 UTC

    FYI I wondered if B::Deparse could show this. The answer is yes, with level 5 of deparsing or higher, use statments will be translated into their equivalent BEGIN blocks:

    perl -MO=Deparse,-x5 -e "use Set my $x = 12;" sub BEGIN { require Set; do { 'Set'->import(my $x = 12) }; } -e syntax OK
    I don't think the fact that the lexical has a scope even shorter than the BEGIN block changes anything though.