Hello,
I didn't follow very well this thread, so I may be going to say
something silly, but...
On Nov 20, 2006, at 2:34 AM, Paul Berkowitz wrote:
> Thanks, has. This is very helpful. And in this particular case I am
> searching through unique items, ASCII only (a list of GUIDs, in
> fact), so no
> extra manipulations are needed.
If this is the case, perhaps the following perl script may be of some
interest:
#!/usr/bin/perl
use strict;
use warnings;
my $a = "a, i, u, e, o";
my @a = split (/, */, $a);
my %a;
my $i = 1;
map {$a{$_} = $i; $i++} @a;
print &return_indice ("o");
sub return_indice {
my $word = shift;
exists $a{$word}? return $a{$word}: return 0;
}
The basic idea is that finding a 'key' value in a hash is very fast;
so you would convert your list into a hash. And 'map' is *perhaps*
faster than the simple loop.
Best regards,
Nobumi Iyanaga
Tokyo,
Japan
|