[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : I have two text files I would like to open and read at the : same time. Whats the best way to do this? : : I was think along these lines: : : open (TESTFILE, "<somefile.txt")|| die "can not open file";
It is helpful to add the perl error code in there: open (TESTFILE, "<somefile.txt") || die qq|Cannot open "somefile.txt": $!"; : open (LOGFILE, "<my_other_file")|| die "can not open other file"; It would be helpful to know what you're going to do with the files. Do they need to be synchronized? That is, do you need to access the same line of each file together or do you need to access lines of one file and different lines of the other? Are they small files? Can they be safely loaded into memory or are they going to be large files? Do you ever need to go back to an old line you have already processed? Will there ever be a need for more than three files? Finally, are you using perl 5.6.1 or above? You're going to get some helpful answers, but more information about what you intend to do with the files can aid us in finding better solutions. HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>