Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Merging files

by takshaka (Friar)
on Aug 27, 2000 at 09:53 UTC ( [id://29864]=note: print w/replies, xml ) Need Help??


in reply to Merging files

while (my @lines = grep defined, (scalar <FILE1>, scalar <FILE2>)) { print RESULT @lines; }

Replies are listed 'Best First'.
RE: Re: Merging files
by merlyn (Sage) on Aug 27, 2000 at 16:05 UTC
    Brilliant!

    But dangerous as a pattern. Once you hit undef on ARGV (also known as the empty file handle or the diamond operator), you should stop reading from it, or you will end up reading from STDIN instead.

    So your post works fine for all filehandles that stay at EOF once you hit EOF. The magic ARGV filehandle does not.

    -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

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

    No recent polls found