I expected 3rd way to work just like the others, by creating a my variable in main.
If you use Devel::Symdump
, you'll see that my
variables, aren't actually in the main package, they are local to the block.. The list outputted by the following code, shows all scalar symbols in the main package.
my $obj = Devel::Symdump->new('main');
my $var1 = 'var1';
our $var2 = 'var2';
...More Builtin Vars...
Fixed misplaced sentence fragment.