Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: delayed variable interpolation in a regular expression

by ashokpj (Hermit)
on Apr 25, 2006 at 07:42 UTC ( [id://545491]=note: print w/replies, xml ) Need Help??


in reply to delayed variable interpolation in a regular expression

Try like this.
#!/usr/bin/perl my $line = "System has tool zigzag version 3.6"; my $match = 'System\s+has\s+tool\s+(\w)\s+version\s+(.*)'; my $replace = '"System has tool $1 version ABC"'; $line =~ s/$match/$replace/eg; print "Line after replacement: $line \n"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-19 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found