in reply to Re^2: dynamically expand @INC beyond BEGIN
in thread dynamically expand @INC beyond BEGIN

# Here's a variable... my $lib; # Make sure it gets defined at compile-time... BEGIN { $lib = '/foo' } # Use the variable in a "use" line... use lib $lib; # Check that it worked... use Data::Dumper; print Dumper \@INC;

... And lo and behold, it has worked!

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'