Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Adding directories to the end of @INC

by Khen1950fx (Canon)
on Jul 01, 2011 at 17:35 UTC ( [id://912388]=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://912388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-03-17 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.