/eg/lib
You run perl -I/eg/custom myscript.pl.
Now @INC is:</c>
/eg/custom
/eg/lib
Imagine that myscript.pl contains use mylibs which loads /eg/custom/mylibs.pm. This module itself tinkers with @INC at run-time, adding another path at the front.
/corporate/lib
/eg/custom
/eg/lib
Now you want to launch another Perl process via system(), so what do you do? Something like:
my @incs = map { "-I$_" } @INC;
system($^X, @incs, 'other-script.pl');
So when the other script starts, it will start with this in @INC:
/corporate/lib
/eg/custom
/eg/lib
Now let's imagine that other-script.pl also does use mylibs. Rather than that loading /eg/custom/mylibs.pm, it might now load /corporate/lib/mylibs.pm, which is perhaps an older version of the mylibs package which behaves differently to how we wanted.
Granted this is a rare situation, but there do exist packages along these lines; packages that exist entirely to manipulate @INC, such as local::lib. Combining these libraries with system($^X) can get you into a merry little pickle.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|