Perhaps you mean succinct rather than efficient?
use 5.010; ... $hash{$key} //= 0;
is succinct, clear (if you know the syntax) and likely about as efficient in terms of fewest processor cycles as you can get. It requires Perl 5.10, but that shouldn't be a problem most places now.
In reply to Re: Perl Hash Behavior.
by GrandFather
in thread Perl Hash Behavior.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |