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;
Thanks
Ram
Are you finding it slow?
@HASH{@ARRAY} = () _might_ be faster, but are you sure this is a bottleneck?
--
Paul Johnson - pa...@pjcj.net
http://www.pjcj.net
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} = ();
So I just wanted to make sure I was not goofing again.
Thanks for the reply
Ram