Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

How can I compare (the content of) two files?

by Anonymous Monk
on Jun 30, 2000 at 04:46 UTC ( #20522=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (files)

Originally posted as a Categorized Question.

  • Comment on How can I compare (the content of) two files?

Replies are listed 'Best First'.
Re: How can I compare (the content of) two files?
by devslashneil (Friar) on Jun 18, 2003 at 03:00 UTC
    Another way would be to use File::Compare
    eg.
    use File::Compare; if (compare("file1","file2") == 0) { print "They are the same\n"; }
Re: How can I compare(the content) two files?
by QandAEditors on Jun 30, 2000 at 05:21 UTC
    Well, you can use diff, if you're in Unix (or Windows? I don't know):
    % diff file1 file2
    If you're looking to do it in Perl, check out Algorithm::Diff.
      #If you just want to know if the files are equal, you could use File::Compare;
Re: How can I compare(the content) two files?
by QandAEditors on Jun 30, 2000 at 18:50 UTC
    On windows, it's fc.exe. For example,
    c:\> fc file1 file2

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://20522]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2021-04-20 05:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?