You can try accessing the dictionary file directly using the Search::Dict core module, assuming your dictionary is sorted. It performs a binary search through the file. Here, I've wrapped its functionality into an OO-module for convenience:
use Data::Dumper;
use Search::Dict::Object;
my $d = Search::Dict::Object->new(
file => "/tmp/dict.txt",
keyval_xfrm => sub { split /\t/ },
comp => sub { $_[0] cmp $_[1] }, # should correspond to file sort
+order
);
print Dumper {
aaa => $d->get('aaa'),
foo => $d->get('foo'),
bar => $d->get('bar'),
baz => $d->get('baz'),
zzz => $d->get('zzz'),
};
__END__
$VAR1 = {
'bar' => '789',
'baz' => '456',
'aaa' => undef,
'foo' => '123',
'zzz' => undef
};
The dictionary file:
$ cat /tmp/dict.txt
aho 234
bar 789
bat 567
baz 456
cut 678
foo 123
yyy 000
The Search::Dict::Object package:
|