Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Using more than one filehandle

by Aragorn (Curate)
on Mar 24, 2004 at 14:45 UTC ( [id://339415]=note: print w/replies, xml ) Need Help??


in reply to Using more than one filehandle

An untested example of a possible solution:
open(FILE_A, "< file_a.txt") or die "Cannot open file_a: $!\n"; open(FILE_B, "< file_b.txt") or die "Cannot open file_b: $!\n"; while (1) { my $line_a = <FILE_A>; my $line_b = <FILE_B>; last if not defined $line_a or not defined $line_b; # Processing of $line_a and $line_b... } close(FILE_A); close(FILE_B);

Arjen

Log In?
Username:
Password:

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

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

    No recent polls found