Jeff, David, Nikola- I obviously haven't been doing this long, but I already love perl. Thanks for the tips.
A couple quick questions: - Why is the \1, \2, etc. syntax obsolete? The one thing I love about regular expressions is that I can use them within text editors (nedit, textpad, bbedit), but none of these support the $1 notation in the replace string. Why aren't re's consistent between perl and text editors? - What does the "qr" tag do? Thanks again. - Bryan __________________ \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]