in reply to Fast wordlist lookup for game

A hash seems reasonable to use at that dictionary size. 50k is nothing.

Nevertheless, if you're still concerned, I suggest you use grep with eq on the list of words, rather than trying to match a pattern against a long string. That is going to be a lot more efficient.

Something like this:

my %word; open my $fh, "<", "/usr/dict/words"; chomp, push @{$word{substr $_, 0, 1}}, $_ while <$fh>; close $fh;
And then you check using something like:
if(grep $_ eq $user_input, @{$word{substr $user_input, 0, 1} || []}) { # it's there } else { # no, that wasn't it }
If you want to ignore case, you'd just use
chomp, $_ = lc, push @{$word{substr($_, 0, 1)}}, $_ while <$fh>; # and grep lc eq $user_input, @{$word{substr($user_input, 0, 1)} || []}
respectively.

Makeshifts last the longest.