Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Array Element Substitution

by aaron_baugher (Curate)
on Aug 23, 2012 at 20:00 UTC ( #989375=note: print w/replies, xml ) Need Help??


in reply to Array Element Substitution

Short, ugly version below. Responsible error checking and file handling are left to the student.

#!/usr/bin/env perl use Modern::Perl; my @old = `cat old.txt`; chomp @old; my @new = `cat new.txt`; chomp @new; my %h; @h{@old} = @new; my $text = `cat log.txt`; $text =~ s/$_/$h{$_}/g for @old; print $text;

Aaron B.
Available for small or large Perl jobs; see my home node.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989375]
help
Chatterbox?
[Eily]: LanX bless you!
[LanX]: why?
[Eily]: TSJAKKAA looks like a sneeze to me
[LanX]: oh thank you! :)
[Eily]: partly because I read tsj as /t͡ʃ/, don't know if that's supposed to be the case
[LanX]: Yeah I think thats Dutch spelling rule
[erix]: but we don't sneeze any K's
[choroba]: we do
[Eily]: that was a sneeze overpowering a cough
[choroba]: Czechs sneeze "Hep-cheek"

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2017-04-24 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (442 votes). Check out past polls.