I won't repeat fletch's comments; just second them.

I've got some questions (yes, this is a quiz)

  1. The files differ (you've said they're not the same size); so when you say "Compare," what do you mean? I can guess that you're looking to see if address information is consistent between two files, but no more than that.
  2. Have you considered one of the modules, such as Algorithm::Diff, which computes an "intelligent difference between two files?"

On a more minor note: you probably want and vs the & (bitwise and) operator in your if test and you probably want to use ne, which is the string comparison operator, vs !=, which is for numeric comparisons. You've used strict, but never declared your variables, which will keep your code from compiling.

My suggestions are:


added in update

I know fletch mentioned the &, use strict; without corresponding variable declarations, and the need for the OP to post samples and (at least syntactically valid) source code. I got into my pedantic mode, and ended up repeated fletch's advice.

emc

e(π√−1) = −1

In reply to Re: Comparing text files by swampyankee
in thread Comparing text files by lynxct

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.