in reply to use has it's own scope?

use docs say "It is exactly equivalent to BEGIN { require Module; Module->import( LIST ); }" so probably yes LIST has its own scope.

Replies are listed 'Best First'.
Re^2: use has it's own scope?
by LanX (Saint) on Aug 07, 2017 at 22:35 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.