Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Simple filter from rows of input file

by 2teez (Vicar)
on Aug 13, 2014 at 20:32 UTC ( [id://1097347]=note: print w/replies, xml ) Need Help??


in reply to Simple filter from rows of input file

Hi ablakely,

From your code written, I can figure what you are doing is read from a file, then match what you read from the first file in the second file. Then write it out to the third file.
If that is correct, then do this, read the first file into a hash variable, then read the second file one line at a time, to match what you have in the hash, then simply print out to the third file. QED!
You can simply, write a subroutine that open and read a file and you use that to read the first two files!
Also don't forget to use strict; in your script! And check if your opened file failed!

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found