Billy wrote: > > how to judge a file in dos format or in unix format? > thanks for your response.
Here is a somewhat simple program that will work with most files. :-) #!/usr/bin/perl use warnings; use strict; open my $fh, $ARGV[0] or die "Cannot open $ARGV[0]: $!"; my $contents = do { local $/; <$fh> }; my $cr = $contents =~ tr/\015//; my $lf = $contents =~ tr/\012//; if ( $cr == $lf and $cr ) { print "$ARGV[0] is a DOS file.\n"; } elsif ( $lf and not $cr ) { print "$ARGV[0] is a Unix file.\n"; } elsif ( $cr and not $lf ) { print "$ARGV[0] is a Macintosh file.\n"; } else { print "$ARGV[0] is an Unknown file.\n"; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]