Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Think about Loose Coupling
 
PerlMonks  

Re: Array Element Substitution

by cheekuperl (Monk)
on Aug 24, 2012 at 03:03 UTC ( #989424=note: print w/ replies, xml ) Need Help??


in reply to Array Element Substitution

The way I see it, you have a certain orig_name=>new_name mapping (a hash) where $hash{$orig_name}=$new_name. And you wish to replace all orig_name in your log_file with new_name.

#Open the file and slurp it into an array @lines #Search orig_name in line and replace it with new_name map{s/$orig_name/$new_name/g} @lines; #Write the transformed array into file again


Comment on Re: Array Element Substitution
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-04-17 15:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (451 votes), past polls