I don't remember if it was quicker, but there also is the non-looped version:I haven't benchmarked it, but I've frequently heard it asserted that even faster isundef %saw; @saw{@in} = (1) x @in; @out = keys %saw;
That is, using undef as your values (so you don't need the increment or to create the list of ones).undef %saw; @saw{@in} = (); @out = keys %saw;
In reply to Re^2: What does !$saw{$_}++ means
by Eimi Metamorphoumai
in thread What does !$saw{$_}++ means
by nwkcmk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |