Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Roy Johnson (Monsignor)
on Apr 08, 2005 at 12:49 UTC ( #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
Node Status?
node history
Node Type: note [id://446005]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-04-12 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?