sub frobnicate { $_[0] =~ s/foo/bar/; $_[0] =~ s/\d/\&/g; } my $var = "foo 12345"; frobnicate($var); # $var is now "bar &&&&&"