Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: How to use a variable in tr///

by Roy Johnson (Monsignor)
on Apr 08, 2005 at 12:49 UTC ( [id://446005]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to use a variable in tr///
in thread How to use a variable in tr///

The "why not just eval?" referred to the case of embedding an eval'd tr/// in an s///e, which would be no better. But your cautions are valid. [Update: and addressed here]

Update:
Though for character replacement, I'd build the regex using a character class rather than alternation:

my $table_re = sprintf '[%s]', join '', map quotemeta, keys %table;

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-28 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found