Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Substitution backreference woes

by 2teez (Vicar)
on Jan 24, 2015 at 13:21 UTC ( [id://1114363]=note: print w/replies, xml ) Need Help??


in reply to Substitution backreference woes

With my $substitution = 'Goodbye \1'; which is obviously not a regex, which regex "group" are you back-referring to?

Check this however:

my $string = "Hello sailor"; my $regex = qr/Hello (.*)/; $string =~ s/$regex/Goodbye \1/; print "string is now $string \n";

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1114363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found