my $test = "foo bar"; print "Test is now: $test \n"; test($test); print "Test is now: $test \n"; sub test { $_[0] =~ s/foo/whatever/g; }