> Is there any other idiom for transforming an array to a hash
> for quick search? I'm looking for some short hack.
>
> sub array2hash {
> my ($array) = @_;
> my %hash;
> foreach my $array_item (@$array) {
> $hash{$array_item}++
> }
> return \%hash;
> }
>
What about:
%hash = map { $_, 1 } @array;
-David