\1 is obsolete. try $1 and you also have use the /ee and fix your $replace for the /ee read perldoc perlre
$match = qr/cat(\d+)/; $replace = '$1. "dog"'; $_ = "cat15"; s/$match/$replace/gee; print $_, "\n"; # prints --> 15dog > -----Original Message----- > From: Bryan R Harris [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 28, 2002 10:46 AM > To: Beginners Perl Mailing List > Subject: using search backreferences in a variable > > > > Why does this segment not work properly? > > $match = "cat(\d+)"; > $replace = "\1dog"; > $_ = "cat15"; > s/$match/$replace/g; > print $_; # prints --> \1dog > > Any ideas? > > TIA. > > - B > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]