use strict; use warnings; my $c = 'this is another test'; $c =~ s/^this is/XX/; my $msg = 'this is a test'; my $pat = ''; my $rep = ''; $msg =~ s/$pat/$rep/; print $msg, "\n";