#!/usr/bin/perl #Written by Nick (see http://illx.org for more details) #'cause I had found anything like this out there my $count = 0; my $file = $ARGV[0]; unless($file) { die "Won't continue with an argument!\n", "Usage: ./ascii_check.pl file_to_check_ascii_compliance\n\n"; } unless( -e $file ) { die "The file $file you specified doesn't exist...\n"; } open(IN, "$file") or die "Can't open $file: $!\n"; while() { chomp; my @split = split(//, $_); foreach $l (@split) { my $ord = ord($l); if($ord <= 127) { } else { $count++; } } } close(IN); if($count == 0) { print "It's all ASCII!\n"; } else { print "Hmm.. its NOT all ASCII\n"; print "There were $count occurences of non-ASCII characters\n"; }