in reply to Shorten this one-liner!
Update: Current shortest version isIt's your competition, so you're free to set the rules ... though be aware that your solution, while short, is not super robust or portable. Re robustness, try changing "declare" to "delete" :) -- that is, while it works for your four chosen words, there are many barewords that will require quoting. Re portability, note that -E'...' works fine on Unix but fails on Windows (which needs -E"..." instead).
perl -E'/a/&&say"$_: ".y/e//for anyone,cancel,declare,perlmonks'
BTW, since you're interested in code golf, you might be interested in some of the articles I've written over the years on this topic, for example:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Shorten this one-liner!
by lunix (Novice) on Aug 26, 2018 at 15:22 UTC | |
by Marshall (Canon) on Aug 28, 2018 at 00:51 UTC |