DBM::Deep is an ideal solution for this problem. Building the DBM file might take a little time, but lookups would be pretty quick. And, it's about as simple an implementation as you could want.
my $db = DBM::Deep->new( $filename );
print "$db->{32}\n"; # prints 14456