{
    "mode": "perldoc",
    "parameter": "File::Compare",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/File%3A%3ACompare/json",
    "generated": "2026-06-03T09:46:02Z",
    "synopsis": "use File::Compare;\nif (compare(\"file1\",\"file2\") == 0) {\nprint \"They're equal\\n\";\n}",
    "sections": {
        "NAME": {
            "content": "File::Compare - Compare files or filehandles\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use File::Compare;\n\nif (compare(\"file1\",\"file2\") == 0) {\nprint \"They're equal\\n\";\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The File::Compare::compare function compares the contents of two sources, each of which can be a\nfile or a file handle. It is exported from File::Compare by default.\n\nFile::Compare::cmp is a synonym for File::Compare::compare. It is exported from File::Compare\nonly by request.\n\nFile::Compare::comparetext does a line by line comparison of the two files. It stops as soon as\na difference is detected. comparetext() accepts an optional third argument: This must be a CODE\nreference to a line comparison function, which returns 0 when both lines are considered equal.\nFor example:\n\ncomparetext($file1, $file2)\n\nis basically equivalent to\n\ncomparetext($file1, $file2, sub {$[0] ne $[1]} )\n",
            "subsections": []
        },
        "RETURN": {
            "content": "File::Compare::compare and its sibling functions return 0 if the files are equal, 1 if the files\nare unequal, or -1 if an error was encountered.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "File::Compare was written by Nick Ing-Simmons. Its original documentation was written by Chip\nSalzenberg.\n",
            "subsections": []
        }
    },
    "summary": "File::Compare - Compare files or filehandles",
    "flags": [],
    "examples": [],
    "see_also": []
}