Ramprasad A Padmanabhan said:
> Which is the quickest way of converting an array to hash keys
>
> I have an array
> @ARRAY = qw ( a b c d e );
>
> # Convert array to hash keys , so can easily check for exists
> # The values of the hash are immaterial to me
>
> @HASH{@ARRAY}=@ARRAY;
>
> ....
> ....
> foreach (@SOME_OTHER_ARRAY) {
>       next if(exists($HASH{$_}));       # This is why I require a hash
> .....
> ....
> }
>
>
> Can I have a faster way than this @HASH{@ARRAY} = @ARRAY;

Are you finding it slow?

@HASH{@ARRAY} = () _might_ be faster, but are you sure this is a bottleneck?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to