So I just wanted to make sure I was not goofing again.
Thanks for the reply
Ram
Sudarshan Raghavan wrote:
On Thu, 28 Nov 2002, Ramprasad A Padmanabhan wrote: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;
Why do you think this is slow? Some other options are to use for or map...
I did a benchmark and a hash slice seems to be the fastest. If you don't care about the values you can do this
@HASH{@ARRAY} = ();
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]