Or is this more like something you had in mind:
File MyPackage.pmuse warnings; use strict; use MyPackage; print $MyPackage::var;
File MyUtils.pm# MyPackage.pm package MyPackage; use warnings; use strict; use MyUtils; 1;
# MyUtils.pm package MyUtils; use warnings; use strict; { no strict 'refs'; my $importing_package = (caller 0)[0]; ${ $importing_package . '::var' } = 42; } 1;
c:\@Work\Perl\monks\TerryBerry>perl set_in_importing_script_1.pl 42
Give a man a fish: <%-{-{-{-<
In reply to Re: Set a variable in calling package
by AnomalousMonk
in thread Set a variable in calling package
by TerryBerry
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |