#!/usr/bin/perl use Text::Aspell; my $speller = Text::Aspell->new; die "NO ASPELL FOUND" unless $speller; $file = $ARGV[0]; open(FILE, $file); @file = ; close(FILE); foreach $line(@file) { @words = split(' ',$line); foreach $word(@words) { &checkWord($line,$word); } } sub checkWord { $line = shift; $word = shift; $speller->set_option('lang','en_UK'); $speller->set_option('sug-mode','fast'); # check a word $found = $speller->check( $word ); # lookup up words my @suggestions = $speller->suggest( $word ); #used to check the choices $sugLength = @suggestions; if($found == 0){ print $line."\n"; my $count = 1; foreach $word(@suggestions){ print $count.")\t".$word."\n"; $count++; } print "\n\nChoose replacement word. (enter to skip, 0 to exit): "; $choice = ; chomp ($choice); if($choice > 0 && $choice < $sugLength) { print $suggestions[$choice-1]."\n"; }elsif($choice eq 0){ exit(0); } system(clear); } }