Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Anonymous Monk
on Jun 30, 2000 at 04:46 UTC ( [id://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 Anonymous Monk 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 Anonymous Monk 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
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://20522]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-23 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found