#! perl -slw use strict; open W, '<', 'words.txt' or die $!; my @words = ; close W; chomp @words; chomp( my $bad = lc shift() ); for my $good ( @words ) { next if length $good != length $bad; my $mask = $good ^ $bad; my $match = $mask =~ tr[\0][]; next unless $match; printf "$bad has a %.2f%% chance of being: $good \n", $match / length( $good ) * 100; }