$ cat b.pl use warnings; use strict; print "Hello, I'm b.pl"; $ cat a.pl use warnings; use strict; use Capture::Tiny qw/capture_stdout/; my $stdout = capture_stdout { require 'b.pl'; }; print "<$stdout>\n"; $ perl -I. a.pl