1 2 3 4 5 6 7 8 9 10
#!/usr/bin/perl my $file = $ARGV[0]; my $r = -r $file ? ( -B $file ? "The file content is binary" : "The file content is ascii" ) : "Could not open file: $file"; print $r;