c:\@Work\Perl>perl -wMstrict -le "use Data::Dump; ;; my @cleanwords = qw(hut Hat foo HIC); my @allwords = qw(hit Het HAT HiC hAc hoc); ;; my %dict = map { $_ => 1 } map canonicalize($_), @allwords ; dd \%dict; ;; for my $word (@cleanwords) { my $common = canonicalize($word); printf qq{word '$word' %sin dictionary \n}, exists $dict{$common} ? '' : 'NOT '; } ;; sub canonicalize { return lc $_[0]; } " { hac => 1, hat => 1, het => 1, hic => 1, hit => 1, hoc => 1 } word 'hut' NOT in dictionary word 'Hat' in dictionary word 'foo' NOT in dictionary word 'HIC' in dictionary