my $bigref = bigget; ... do something ... do_something_more( $bigref ); sub bigget { local $/ = undef(); # disable carriage control locally open my $fh, $ENV{BIG_STUFF} or die "$!: \$ENV{BIG_STUFF}\n"; my $slurp = <$fh>; close $fh; \$slurp; # return the reference to $slurp, which also keeps it alive outside this scope!!! } sub do_something_more { my $bigref = shift; # copying the ref not the string $$bigref =~ /^\s+(\S+)/; # using a dereference my $first_word = $1; ... do more ... }