sub openOut { my $file_handle = $_[0]; my $output_file = $_[1]; ... } #### #!perl use Foo qw(openOut); openOut(*BAR,"~/output.txt"); print("Hello world!\n");