Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Search & Replace Across Two Files

by generator (Pilgrim)
on Nov 21, 2010 at 12:01 UTC ( [id://872782]=note: print w/replies, xml ) Need Help??


in reply to Search & Replace Across Two Files

Well, for one thing, both files are being opened for "read only" access ("<"). "+<" will allow both read and write.

You might consider reading the first file's code - room pairs into a hash (presuming that each numeric code is unique) and open the second file substituting the hash key for the hash value "looked up" in the first file.

<><

generator

Replies are listed 'Best First'.
Re^2: Search & Replace Across Two Files
by tod222 (Pilgrim) on Nov 21, 2010 at 23:28 UTC
    "+<" will allow both read and write.

    In most cases like this one modifiying an input file is a really bad idea.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found