"Wiggins d'Anconia" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Robert wrote: > > When Perl is doing this comparison is it doing it line by line (like an > > actual DIFF) or is it putting the lines into an "array" and the checking > > that array against the second file? > > > > Well yes and no, to both. It is storing the lines temporarily, but it is > storing them to a hash, not an array. Then it is checking them line by > line. Depending on the purposes there are several large differences > between the code and a "DIFF". For one, order is not maintained in a > hash so it is really checking just to see if the line did exist in the > first file, rather than that they are in the same order, which matters > to a diff. Secondly it is checking to see if that line is in fact Perly > true, so if a line consisted of just a 0 it would be false and return a > false negative. Thirdly, because a hash can only store a key a single > time then duplicated lines would be unconditionally kept, and no > indication provided, even if for example the second file contained 43 > copies of the same line and the first file only contained 1. > > There are other issues, for instance the first three opens check for > success but the others don't. Additionally there is absolutely no > reason to open/close the file within the loops, this really kills > efficiency. > > If you are really looking for a diff creator there are several good ones > on CPAN. > > http://danconia.org >
Thanks. I am looking to see what is IN one file but NOT in the other (not a DIFF). I will check but I believe that the lines themselves are unique. I will remove the open and close from the loop and I fixed the checking for open success. Thanks! Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>