use v5.10; use strict; use warnings; use PadWalker (); { package Some::Module; sub what_is_x { my $value = $Other::Module::x; say "\$x is $value"; } # Just because PadWalker exists, doesn't mean it's a good idea... sub what_is_y { my $value = ${ PadWalker::peek_my(1)->{'$y'} }; say "\$y is $value"; } } { package Other::Module; our $x = 123; my $y = 456; Some::Module::what_is_x(); Some::Module::what_is_y(); }
In reply to Re: Can I from within a module access variables from the calling program?
by tobyink
in thread Can I from within a module access variables from the calling program?
by HJO
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |