Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: reading lines from 2 different files

by duff (Vicar)
on Oct 08, 2007 at 15:41 UTC ( #643487=note: print w/ replies, xml ) Need Help??


in reply to reading lines from 2 different files

Something like this:

# assuming you've got the files open in handles $fh1 and $fh2 while (1) { last unless defined($line_from_file_1 = <$fh1>); last unless defined($line_from_file_2 = <$fh2>); # ... }

Basically you just use the "read a record" operator (<>, aka diamond operator) on each file handle. See also readline.


Comment on Re: reading lines from 2 different files
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2014-09-18 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (120 votes), past polls