$cache{$_}++;That is poor form especially for your application. You aren't counting how often the element is present - you just care about whether the key exists. $cache{$_} = undef is better because the value isn't actually created and doesn't have to go through the whole postinc process. So its lighter weight on memory and on performance.
In reply to Re: Internals question - "exists" for hash keys versus grep'ing array
by diotalevi
in thread Internals question - "exists" for hash keys versus grep'ing array
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |