Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Replace strings with []

by ainkov (Novice)
on Oct 14, 2013 at 06:41 UTC ( #1058131=note: print w/replies, xml ) Need Help??

in reply to Replace strings with []

I believe another option is to use \Q and \E in your regular expression.
This will "quote (disable) pattern metacharacters till \E":

$str =~ s/\Q$_\E/$random{$_}/g;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058131]
[stevieb]: it's a long day when you want to make changes to a project and the entire test suite takes 2 hours to fully run :)
choroba knows the situation. At work, unit tests run for 30 minutes, and integration and end-to-end tests take almost one hour.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2017-03-26 22:02 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.