If this is the case then it seems counter intuitive at first glance, and maybe is something that could be modified.
One advantage of using exists $hash{$key} is that the hash values can then all be assigned undef, potentially saving memory. (Although one could also create a scalar ref and re-use it, e.g. my $flag = \1 - this is what is used in Hash::Ordered as a tombstone value.
In reply to Re^2: "exists $hash{key}" is slower than "$hash{key}"
by swl
in thread "exists $hash{key}" is slower than "$hash{key}"
by swl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |