Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

file::compare(3pm) [centos man page]

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 "; } 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 reference to a line comparison function, which returns 0 when both lines are considered equal. For example: 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.16.3 2013-02-26 File::Compare(3pm)

Check Out this Related Man Page

Number::Compare(3)					User Contributed Perl Documentation					Number::Compare(3)

NAME
Number::Compare - numeric comparisons SYNOPSIS
Number::Compare->new(">1Ki")->test(1025); # is 1025 > 1024 my $c = Number::Compare->new(">1M"); $c->(1_200_000); # slightly terser invocation DESCRIPTION
Number::Compare compiles a simple comparison to an anonymous subroutine, which you can call with a value to be tested again. Now this would be very pointless, if Number::Compare didn't understand magnitudes. The target value may use magnitudes of kilobytes ("k", "ki"), megabytes ("m", "mi"), or gigabytes ("g", "gi"). Those suffixed with an "i" use the appropriate 2**n version in accordance with the IEC standard: http://physics.nist.gov/cuu/Units/binary.html METHODS
->new( $test ) Returns a new object that compares the specified test. ->test( $value ) A longhanded version of $compare->( $value ). Predates blessed subroutine reference implementation. ->parse_to_perl( $test ) Returns a perl code fragment equivalent to the test. AUTHOR
Richard Clamp <richardc@unixbeard.net> COPYRIGHT
Copyright (C) 2002,2011 Richard Clamp. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
http://physics.nist.gov/cuu/Units/binary.html perl v5.18.2 2011-09-21 Number::Compare(3)
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl rename failed

i have a file, which i want to rename, from my current directory to a backupdirectory. My perl code is below rename($s_filename,$backup.$s_filename ) all my variables are defined. but the rename failed. the file permission my file is "-rw-rw-r--". could this be a problem? I tried to use the... (9 Replies)
Discussion started by: new2ss
9 Replies

2. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies

3. Shell Programming and Scripting

perl help

Hi When call the below perl file comparision script , I was getting records which are having differences but not in what I am expecting $f1 = 'a'; open FILE1, "$f1" or die "Could not open file \n"; $f2= 'b'; open FILE2, "$f2" or die "Could not open file \n"; $outfile = 'diff.txt'; my... (1 Reply)
Discussion started by: akil
1 Replies

4. Shell Programming and Scripting

Delete blank lines from a file

Hi, I want to use diff to compare two files in a Perl file. But one of the files has some blank lines at the end. So I want to delete the blank lines from the file firstly and then use diff to compare them. But I dont know how to delete the blank lines from the files. Meanwhile, the system is... (5 Replies)
Discussion started by: Damon_Qu
5 Replies

5. Shell Programming and Scripting

How to detect difference between files and print the differences

Dear all, I have some problem here. I want to detect the differences between two text files and count the number of differences between them. Such as file1.txt i have : I am new in perl. and file2.txt i have : I ma enw in pearl. So it should return me 3 as the number of differences. So... (2 Replies)
Discussion started by: branred
2 Replies