in reply to Idiomatic Array Index Search?
%database_index; # Run me once my $idx=0; for (@database) { $database_index{$_} = $idx++; } # /Run me once # good candidate for a BEGIN block - caveat dynamic # This is pretty standard and not best for all situations
Now $database_index{'query'} gives you what you want. This must be run again if the database changes, so it's awkward for dynamic situations.
After Compline
Zaxo
|
|---|