in reply to Re^2: Collapsing a string to unique characters
in thread Collapsing a string to unique characters
38, resp. 36 when using say instead of print
-nle@_[unpack'C*',$_]=/./g;@_=!print@_
Update:And 36 resp. 34:
-nle@_[ord]=$_,for/(.)/g;@_=!print@_
And if you're using the -E+say, you can shave off one more by leaving off the -l, at 33 strokes:
-nE@_[ord]=$_,for/(.)/g;@_=!say@_
Update2: And incorporating BrowserUk and JavaFan's ideas:
# 34 strokes on Windows, and also Unix if your shell doesn't treat "!" + special -nE@_[map+ord,/./g]=/./g;@_=!say@_
|
|---|