CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [JackieZhou] Question about merging two files in perl: Edit Log



7stud
Enthusiast

Jan 20, 2013, 2:56 PM


Views: 1097
Re: [JackieZhou] Question about merging two files in perl

Read each line in file2, and enter the ids as the keys in a hash, the values don't matter (undef is a good choice).

Read 4 lines from your file. Check whether the id in the first line is in the hash:

Code
my $id = $lines[0]; 

if ( exists $ids{$id} ) {
#write the 4 lines to an output file
}



(This post was edited by 7stud on Jan 20, 2013, 3:01 PM)


Edit Log:
Post edited by 7stud (Enthusiast) on Jan 20, 2013, 2:57 PM
Post edited by 7stud (Enthusiast) on Jan 20, 2013, 3:01 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives