#!/usr/bin/perl use strict; die "$0 file2chk\n" unless @ARGV == 1 and -f $ARGV[0]; $/ = "\x0a"; # make sure we're "platform independent"! open( I, $ARGV[0] ) or die "$ARGV[0]: $!"; my $crlf; while () { if ( "\x0a" ne chop ) { # $. is incremented for the last record, $.--; # even when the file does not end with \x0a } elsif ( "\x0d" eq chop ) { $crlf++; } } print "$ARGV[0] : $. \\x0A, $crlf CRLF\n";