I won't repeat fletch's comments; just second them.
I've got some questions (yes, this is a quiz)
- 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.
- 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:
- Add some explanation of what you're trying to do.
- Give us some data (it has to be properly formatted and sensible, i.e., validly formatted, albeit not necessarily real addresses.
- Give us a working code sample, i.e., one that will at least compile.
- Show us what you want and what you're actually getting for a test case.
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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.