Skip to main content
6 events
when toggle format what by license comment
Jun 28, 2019 at 4:27 comment added Xcali Using -F on the command line lets you change this to say+(@F,0)[0,1,(unpack+S7,"g+g+ÜRÉ/Â¥[ [")[$#F]=~/./g] saving 5 bytes in the code.
Sep 26, 2018 at 16:33 comment added J-L The warning that says "(gives incorrect results if the input has a trailing newline)" can be eliminated by changing "Run with perl -nE" to "Run with perl -lnE". (The -l part of the switch gets rid of the trailing newline for you.)
Sep 26, 2018 at 16:27 comment added J-L Ah! I figured it out! I needed to use the -l switch (that's "ell" as in the "letter L") with the -nE switch, like this: perl -lnE 'say+(/./g,0)[0,1,(11111,11111,21212,12233,42434,23455,23456)[y/#//c]=~/./g]' . Now it works correctly.
Sep 26, 2018 at 16:04 comment added J-L This time I replaced the unpack() & pack() calls with the literal shorts, and got: perl -nE 'say+(/./g,0)[0,1,(11111,11111,21212,12233,42434,23455,23456)[y/#//c]=~/./g]'. It still appears to be wrong, as "#a" still yields the incorrect answer of "#a0a0a0" (instead of "#aaaaaa").
Sep 26, 2018 at 2:27 comment added J-L I replaced the Latin-1 string with a call to pack(), and got: perl -nE 'say+(/./g,0)[0,1,(unpack+S7,pack "H*","672b672bdc52c92fc2a59f5ba05b")[y/#//c]=~/./g]' . But when I type "#a", I get "#a0a0a0" which I think is wrong. It should be "#aaaaaa". (Maybe I made a mistake in the pack() call.)
May 31, 2017 at 11:45 history answered Grimmy CC BY-SA 3.0