Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Uer Perl Variable in file

by tinita (Parson)
on Aug 06, 2012 at 14:24 UTC ( #985737=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Uer Perl Variable in file
in thread Uer Perl Variable in txt file

my $search_for = join '|', map quotemeta, keys %replace; ... s/\$($search_for)/$replace{$1}/g;
Additionally:
when doing things like this and you have two hash keys "foo" and "foobar", either use \b in the regex if possible, or sort the hash keys for length before joining. otherwise $foobar could be replaced with the value of $replace{foo}.
s/\$($search_for)\b/$replace{$1}/g;


Comment on Re^3: Uer Perl Variable in file
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-12-28 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (181 votes), past polls