$ cat b.pl #!/usr/bin/env perl use strict; use warnings; print "foo!\n"; $ perl -I. -e 'require "b.pl";' foo! $ perl -I. -e 'open my $o, ">out"; select $o; require "b.pl";' $ cat out foo!