in reply to Location of @INC in win2000
in thread @INC

It is located somewhere in the binary executable of your Perl interpreter, the exact offset of which tends to change from version to version. But I don't think you really want to know about that. I think what you really want to know is what directories does @INC point to? The following script will print it them out for you:

#! /usr/bin/perl -w use strict; foreach( @INC ) { print "$_\n"; }
If you want to include a module from code run anywhere, you have to arrange for it to be stored in one of these directories. Assuming one of the directories in @INC is c:\perl\lib\site_lib, if you wrote a module named Foo/Bar.pm, you would store it in c:\perl\lib\site_lib\Foo\Bar.pm.

Note that if you run the perl interpreter without doing anything special, the current directory (.) will be included in @INC. Should you run perl with taint checks enabled (via -T), then this will not be the case.

If you want to add your own directory to the @INC array, the preferred way of doing it is:

use libs 'c:/personal/code';

Use forward slashes rather than backslashes in Win32 path names. Perl understands both, but you'll avoid hairy escaping problems. use lib will push your added directory to the beginning of the list, which gives you a handy way of writing your own versions of modules to replace existing library code.

~
--
g r i n d e r