perl -ne'$seen{$_}||=(print,1)'
Assuming the print will not fail (and for oneliners, I think it's safe to assume print will print succesfully):
See? print, like many other commands, returns true on success, which allows you to shorten the shortened shortening by another 4 characters!perl -ne'$seen{$_}||=print'
Using symbolic references, assuming no special variable names will be used:perl -ne'$s{$_}||=print'
I think Perl 6 should have an alias for print that is a single \W character ;) Would be fun for golfing, and could compensate for the needed whitespace with string concats :)perl -ne'$$_||=print'
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
In reply to Re: Re: Re: Better "uniq" idiom?
by Juerd
in thread Better "uniq" idiom?
by RMGir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |