#!/usr/bin/perl BEGIN{ # necessary unshift @INC,'/home/shmem/tmp/foo'; # so 'use lib' } # gets my version use lib "/home/shmem/tmp/foo"; # this dir is now sticky BEGIN { print "lib is ",$INC{"lib.pm"},$/; } use lib "/some/path"; BEGIN { print "\@INC after 'use lib \"/some/path\":\n"; print "$_\n" for @INC; } use lib "/another/path"; BEGIN { print "\@INC after 'use lib \"/another/path\":\n"; print "$_\n" for @INC; } __END__ lib is /home/shmem/tmp/foo/lib.pm @INC after 'use lib "/some/path": /home/shmem/tmp/foo /some/path /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl . @INC after 'use lib "/another/path": /home/shmem/tmp/foo /another/path /some/path /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .