http://qs321.pair.com?node_id=912388


in reply to Adding directories to the end of @INC

But it's a bit cryptic...

Let's make it a little less cryptic.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my $foo; my $bar; BEGIN { $foo = '/foo'; $bar = '/bar'; } my(@dirs) = ($foo, $bar); use lib @dirs; push @INC, @dirs; print Dumper(@dirs), "\n", join("", @INC), "\n"; no lib @dirs; exit;
Update: Used lib::tiny and made a few changes.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my $foo; my $bar; BEGIN { $foo = '/foo'; $bar = '/bar'; } my @dirs = ($foo, $bar); use lib::tiny @dirs; push @INC, @dirs; foreach my $dir(@dirs) { print Dumper(join("", @INC)), Dumper($dir), "\n"; } no lib::tiny @dirs; exit;