BashingPerl BashingPerl - 2 months ago 5x
Perl Question

What does perl -I means

I see this a lot in bash scripts and I cannot see this in the manual and other sites.

What does the -I in running a perl script mean?

It is run like this:

perl -I$prod_dir $prod_dir/ <parameter1> <parameter2>

Can someone explain it to me?



Directories specified by -I are prepended to the search path for modules (@INC ).

Source: perlrun documentation

It means perl will include the modules available under specified directory following -I which is $prod_dir in your case.

By default Perl picks up modules from @INC. If you want to use a module which is not available in @INC then you can specify the directory using -I. This specified directory will be appended to @INC at run time.

Also read: