BashingPerl
BashingPerl

Reputation: 83

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/script.pl <parameter1> <parameter2>

Can someone explain it to me?

Upvotes: 1

Views: 554

Answers (1)

Chankey Pathak
Chankey Pathak

Reputation: 21676

-Idirectory

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:

Upvotes: 8

Related Questions