use strict;
use warnings;
use 5.012;
our $x;
use Data::Dumper;
say Dumper($main::{x}); #%main:: is the name of the symbol table
say Dumper($main::{say});
say Dumper($main::{print});
--output:--
$VAR1 = *::x; #typeglob for 'x', in package ::(shorthand for main::)
$VAR1 = undef;
$VAR1 = undef;
####
use strict;
use warnings;
use 5.012;
use subs qw( print );
sub print {
printf "%s %s\n", shift, 'world';
}
print 'hello';
--output:--
hello
##
##
use strict;
use warnings;
use 5.012;
use Data::Dumper;
say Dumper($main::{chdir});
--output:--
$VAR1 = undef;
##
##
use strict;
use warnings;
use 5.012;
use subs qw( chdir );
sub chdir {
printf "%s %s\n", shift, 'world';
}
chdir 'hello';
--output:--
hello world