Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Golf for unique digits

by choroba (Abbot)
on Jan 09, 2013 at 11:31 UTC ( #1012444=note: print w/ replies, xml ) Need Help??


in reply to Golf for unique digits

perl -E'$y=2013;$y=~/$_/&&$c++for 0..9;say$c'
Update: and -> &&. Thanks space_monk.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Golf for unique digits
Select or Download Code
Re^2: Golf for unique digits
by space_monk (Chaplain) on Jan 09, 2013 at 11:39 UTC

    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.
      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.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-07-29 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls