in reply to Re: Hash Set
in thread Hash Set

> Also, if the set consists of small integers, and you 
> don't want to iterate over them, then it may be better
> to use an array like
>
> my @set;
> sub contains { @set{$_[0]}; }
> sub add { @set{$_[0]} = 1; }

It seems -- from the operations in the subs -- you have declared a hash called %set somewhere not shown. That, or you are confused about the hash and array operations, in which case correct syntax for working w/ the array would be ...

sub contains { $set[ $_[0] ]; } sub add { $set[ $_[0] ] = 1; }

- parv