$ENV{PATH} = "/foo/bin:/bar/bin:$ENV{PATH}"; $ENV{LD_LIBRARY_PATH} = "/foo/bin:/bar/bin:$ENV{LD_LIBRARY_PATH}"; $ENV{PERL5LIB} = "/foo/lib:$ENV{PERL5LIB}"; use lib "/foo/lib"; use foo; # if I comment the above line and # uncomment below, it works, but that is not what I want. # print `perl -e 'use foo; print "success\n";'`;