ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).



File::Compare(3pm)                    Perl Programmers Reference Guide                    File::Compare(3pm)



NAME
       File::Compare - Compare files or filehandles

SYNOPSIS
               use File::Compare;

               if (compare("file1","file2") == 0) {
                   print "They're equal\n";
               }

DESCRIPTION
       The File::Compare::compare function compares the contents of two sources, each of which can be a file
       or a file handle.  It is exported from File::Compare by default.

       File::Compare::cmp is a synonym for File::Compare::compare.  It is exported from File::Compare only
       by request.

       File::Compare::compare_text does a line by line comparison of the two files. It stops as soon as a
       difference is detected. compare_text() accepts an optional third argument: This must be a CODE refer-ence reference
       ence to a line comparison function, which returns 0 when both lines are considered equal. For exam-ple: example:
       ple:

           compare_text($file1, $file2)

       is basically equivalent to

           compare_text($file1, $file2, sub {$_[0] ne $_[1]} )

RETURN
       File::Compare::compare and its sibling functions return 0 if the files are equal, 1 if the files are
       unequal, or -1 if an error was encountered.

AUTHOR
       File::Compare was written by Nick Ing-Simmons.  Its original documentation was written by Chip
       Salzenberg.



perl v5.8.8                                      2001-09-21                               File::Compare(3pm)

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.