in reply to RE: shortest
in thread shortest

perl -ne's/$&&1?o:e/eg;print'

Okay this rocks and I've voted for your code... I think this is what's happening :

  1. perl -ne ''executes the one liner forever.
    1. the regexp substitutes each character using s/./ and /g.
    2. $& is the previous matches.
    3. &1 is evaluated in the trinary operator ? using /e.
    4. if &1 then replace with odd else replace with even
  2. print defaults to $_, the results of the regular expression.
but what I really wanna know is: what is &1?

Brother Frankus.