> Is there a way to to alter the @INC array, the original @INC is:
>
> /usr/local/lib/perl5/5.00503/sun4-solaris
> /usr/local/lib/perl5/5.00503
> /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
> /usr/local/lib/perl5/site_perl/5.005
>
> and I want my script to go to:
>
> /export/home/mahdi/perl5/5.00503/sun4-solaris
> /export/home/mahdi/perl5/5.00503
> /export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
> /export/home/mahdi/perl5/site_perl/5.005

Just add the extra search paths to your @INC array by doing:

sub BEGIN {
        unshift(@INC, qw(
                        /export/home/mahdi/perl5/5.00503/sun4-solaris
                        /export/home/mahdi/perl5/5.00503
                        /export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
                        /export/home/mahdi/perl5/site_perl/5.005
                        )
                );
}

Or do:

use lib qw(
        /export/home/mahdi/perl50/5.00503/sun4-solaris
        /export/home/mahdi/perl5/5.00503
        /export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
        /export/home/mahdi/perl5/site_perl/5.005
);

If you print out the contents of your @INC array it will display
the additional paths.

Have fun ...

Berry

Reply via email to