in reply to A Random Fortune Cookie

And Now for Something Completely Different

perl -0x25 -e '$_{$.}=$_ while<>; print join"\n",values%_;' # cookie number is a bonus: perl -0x25 -e '$_{$.}=$_ while<>; print join"\n"=>%_;'
bw, --bliako

Replies are listed 'Best First'.
Re^2: A Random Fortune Cookie
by bliako (Abbot) on Mar 11, 2021 at 07:56 UTC

    some more variations:

    # no need to join perl -0x25 -e '$_{$.}=$_ while<>; print %_' # dumps one random cookie (not just shuffling): perl -0x25 -e '$_{$.}=$_ while<>; print ((%_)[$.==$.])' # and this but slicing it perl -0x25 -e '@_{<>}=1; print ((%_)[$.-$.]);' # not sure but this works too (re: looks like slice key is created aft +er slurping) perl -0x25 -e '@_{1..$.}=<>; print %_;'

    p.s. I did not know about -0x25, thanks