use FindBin ($Bin); require qq{$Bin/relative/../path/to/loadCSV.pl}; my $out = your::modulino->run( (qw/-L -Q/) ); print $out; #### package your::modulino; use strict; use warnings; # Note: I know this is awful but it's better than what OP is doing now print __PACKAGE__->run(\@ARVG) if not caller; sub run { my $self = shift; local @ARGV = @_; # shove nearly all loadCVS.pl in here, getopt and all with ONE exception # ... # convert all of your "print" statements such they create the string you # were going to print, then: return $formerly_printed_stuff; } 1;