Syntactic Confectionery Delight | |
PerlMonks |
Re: Unique Array Itemsby tcf22 (Priest) |
on Nov 06, 2003 at 21:31 UTC ( [id://305161]=note: print w/replies, xml ) | Need Help?? |
Use ++$h{$_} instead of $h{$_}++ so the incrementing is done first, before the compare. $h{$_}++ returns the value, which is numerically 0 the first time through, then increments the value. This causes things seen only once to be ignored.
- Tom
In Section
Seekers of Perl Wisdom
|
|