#!perl -w sub foo { my( $ref )= @_; print "Before match: <$$ref>\n"; 'barring something else' =~ /bar/; # reset all capture variables print "After match: <$$ref>\n"; }; 'blargh foo blargh' =~ /(foo)/; foo( \$1 ); print "Attempt 2:\n"; 'blargh foo blargh' =~ /(foo)/; foo( \"$1" ); __END__ Before match: Use of uninitialized value in concatenation (.) or string at q:\tmp.pl line 7. After match: <> Before match: After match: