Code
#!/usr/bin/perl -I/root/Lib/
use Data::Dumper;
print Dumper \@INC;
The above code file name is test.pl and the permission is 755.
When I am running the program using /usr/bin/perl test.pl the output of the @INC contains "/root/Lib" at the end. It is like push in to @INC.
/usr/bin/perl test.pl Output
$VAR1 = [
'/etc/perl',
'/usr/local/lib/perl/5.10.0',
'/usr/local/share/perl/5.10.0',
'/usr/lib/perl5',
'/usr/share/perl5',
'/usr/lib/perl/5.10',
'/usr/share/perl/5.10',
'/usr/local/lib/site_perl',
'.',
'/root/Lib/'
];
But when I am running the program using ./test.pl the output of the @INC contain "/root/Lib/" contain first as well as end also. It is like unshift and push.
./test.pl output
$VAR1 = [
'/root/Lib/',
'/etc/perl',
'/usr/local/lib/perl/5.10.0',
'/usr/local/share/perl/5.10.0',
'/usr/lib/perl5',
'/usr/share/perl5',
'/usr/lib/perl/5.10',
'/usr/share/perl/5.10',
'/usr/local/lib/site_perl',
'.',
'/root/Lib/'
];
So I want to know what is the difference between ./test.pl and /usr/bin/perl test.pl ?