http://www.perlmonks.org?node_id=1012447


in reply to Re: Golf for unique digits
in thread Golf for unique digits

Can you save a character by using && instead of and?

A Monk aims to give answers to those who have none, and to learn from those who know more.

Replies are listed 'Best First'.
Re^3: Golf for unique digits
by eyepopslikeamosquito (Archbishop) on Jan 09, 2013 at 20:14 UTC

    perl -E'$y=2013;$c+=$y=~$_ for 0..9;say$c' perl -E'$y=2013;say~~map$y=~$_,0..9'

Re^3: Golf for unique digits
by space_monk (Chaplain) on Jan 09, 2013 at 11:41 UTC
    Yup, just answered my own question and got a birdie
    perl -E '$y=2013;$y=~/$_/&&$c++for 0..9;say$c'
    A Monk aims to give answers to those who have none, and to learn from those who know more.