sub foo { my $val; if( @_ ) { $val= shift; } else { undef $val; } return $val; } foo( "x" x 10_000 ); # 10,000 bytes of memory still tied up foo() # those 10,000 bytes now free to be reused foo( \( "x" x 10_000 ) ); # the few bytes needed to store a reference still tied up, # but the 10,000 bytes for the string value itself are # already free to be reused.