in reply to Adding to or changing @INC

Since @INC is just an array, you can push new directories to it:
push @INC, '/my/new/path';
But if you are getting at what i _think_ are you, i recommend using this instead:
use lib '/my/lib/stuff';

Jeff

R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--

Replies are listed 'Best First'.
Re: (jeffa) Re: @INC
by Anonymous Monk on Jul 26, 2001 at 02:46 UTC
    Hmmm. I think I may be operating under a false assumption. I was under the impretion that the @INC paths are a global variable. I want to alter that variable, that way I won't have to change ALL of the scripts.
      If you want to avoid changing a bunch of scripts, you can
      setenv PERL5LIB /some/other/directory
      ... or however you do it with your particular shell.
        Awesome, thats what I was looking for. Thanks a lot man.
      @INC is global to the script you are using - one script. You will have to edit each of the scripts you are refering (sic) to . . . sounds like a job for . . . Perl!
      script to edit multiple files and add said line left as exercise to the reader >:)

      Jeff

      R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
      L-L--L-L--L-L--L-L--L-L--L-L--L-L--
      
Re: (jeffa) Re: @INC
by Hero Zzyzzx (Curate) on Jul 26, 2001 at 02:38 UTC

    I've wondered about this myself.

    Why would it be better to use lib '/foo/bar' than to push @INC,'/foo/bar/';?

      You did want your change to be seen while Perl is still compiling the script?