#! perl -slw use strict; die "usage: $0 binfile1 binfile2" unless @ARGV == 2; open my $f1, '< :raw', $ARGV[ 0 ] or die "Couldn't open $ARGV[ 0 ]: $!"; open my $f2, '< :raw', $ARGV[ 1 ] or die "Couldn't open $ARGV[ 1 ]: $!"; my( $d1, $d2 ); sysread( $f1, $d1, -s $ARGV[ 0 ] ) or die "Couldn't read $ARGV[ 0 ]"; sysread( $f2, $d2, -s $ARGV[ 1 ] ) or die "Couldn't read $ARGV[ 1 ]"; close( $f1 ) and close( $f2 ); print "$ARGV[ 0 ] and $ARGV[ 1 ] are ", $d1 eq $d2 ? 'the same' : 'different'; __END__ P:\test>320353 fox1.jpg fox1.jpg fox1.jpg and fox1.jpg are the same P:\test>320353 fox1.jpg fox2.jpg fox1.jpg and fox2.jpg are different