Is there a Perl version of UNIX "cmp"?
The UNIX "cmp" command is used to compare 2 very large, non-human-readable files to confirm if they are the same, or different. Unlike UNIX "diff", UNIX "cmp" is "large-file-aware" and does not bungle the job when comparing 2 large files as UNIX "diff" is prone to do.

Sample "cmp" operations:

TWO FILES ARE SAME:
> cmp engine_security.a@@/main/par_x_rush_r55.1/2 engine_security.a@@/main/par_x_rush_r55.1/2

> echo $?
0

TWO FILES ARE DIFFERENT:
> cmp engine_security.a@@/main/par_x_rush_r55.1/1 engine_security.a@@/main/par_x_rush_r55.1/2

engine_security.a@@/main/par_x_rush_r55.1/1 engine_security.a@@/main/par_x_rush_r55.1/2 differ: char 29, line 2

> echo $?
1


I work for Motorola, and our Perl coding practices say to avoid qx and system calls to non-Perl functions, in all cases in which a Perl equivalent to a UNIX etc. function can be found.

In reply to Is there a Perl version of UNIX "cmp" ? by Amphiaraus

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.