Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Array Element Substitution

by aaron_baugher (Deacon)
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.


Comment on Re: Array Element Substitution
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (15)
As of 2014-08-27 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (242 votes), past polls