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 <Goodbye sailor>
In reply to Re^3: Substitution backreference woes
by LanX
in thread Substitution backreference woes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |