That reminds me of the danger of passing a var to a function that modifies that var. It's particularly easy to screw up when dealing with built-in globals variables such as $1.
sub func {
'b' =~ /(.)/;
print(@_, "\n");
}
'a' =~ /(.)/; func($1); # Prints "b"
'a' =~ /(.)/; func("$1"); # Prints "a"
sub func {
eval { die "bar\n" };
print(@_);
}
eval { die "foo\n" }; func($@); # Prints "bar"
eval { die "foo\n" }; func("$@"); # Prints "foo"
(If you want to mess with your mind, try removing the second 'a' =~ /(.)/; from the first snippet.)