On Fri, May 28, 2010 at 02:53, newbie01 perl <newbie01.p...@gmail.com> wrote: > Hi all, > > Just need to confirm if this is the expected behaviour when setting > PERL5LIB. > > If I have the folllowing in my script ... snip > #!/usr/bin/perl > > $ENV{PERL5LIB}="/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi"; snip
Setting environment variables after perl has started up cannot affect how perl starts up (but will effect any other Perl programs you run with some variant of [exec][0] after that point). If you want to modify @INC at compile time, you should use the lib pragma. Now for the pure silliness's sake, you could always say #!/usr/bin/perl use strict; use warnings; #warning, don't do this, use lib instead $ENV{PERL5LIB} = "/opt"; #if /opt isn't in @INC re-execute the program with the changed env exec $^X, $0, @ARGV unless grep { $_ eq "/opt" } @INC; print "$_\n" for @INC; [0] : http://perldoc.perl.org/functions/exec.html -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/