If you want to use this "unique" construction multiple times, it'll break if you don't clean up %_ afterwards.
So its neat for a one liner, in every other situation I'd rather prefer an explicit my %seen or importing uniq from List::MoreUtils .
Btw your code does nothing, you forgot the ++ part.
@list = grep { !$_{$_}++ } @list;
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re^2: What is %_
by LanX
in thread What is %_
by Russ
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |