in reply to Bidirectional lookup algorithm? (Updated: further info.)
Since your strings and integers are unique - why don't you use a hash for strings and an array for integers
#!/usr/bin/perl -l my %str2int; my @int2str; $i=0; for ('aaaa'..'zzzz') { $str2int{ $_ } = ++$i; $int2str[$i] = $_; }
and look up the strings by index into the array, and the integers by key into the hash?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Bidirectional lookup algorithm? (Updated: further info.)
by Laurent_R (Canon) on Jan 05, 2015 at 19:00 UTC | |
by shmem (Chancellor) on Jan 05, 2015 at 22:34 UTC |