my $string = 'Hello sailor'; my $regex = 'Hello (.*)'; my $substitution = '"Goodbye $1"'; $string =~ s/$regex/$substitution/ee; print "string is now <$string> \n"; #### /usr/bin/perl -w /tmp/regex.pl string is now