Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: String substitution

by Corion (Patriarch)
on Jul 12, 2010 at 16:55 UTC ( [id://849053]=note: print w/replies, xml ) Need Help??


in reply to String substitution

Your search string is interpreted as a regular expression, and it contains regular expression meta characters. See perlre. Maybe you wanted to use quotemeta or \Q|?

$line =~ s/\Q$expr/$n_expr/;

Replies are listed 'Best First'.
Re^2: String substitution
by abhay180 (Sexton) on Jul 12, 2010 at 17:03 UTC
    Thanks a lot. That helps. Indeed i seem to have forgotten the basic rules of substitution :-)

Log In?
Username:
Password:

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

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

    No recent polls found