Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Golf for unique digits

by space_monk (Chaplain)
on Jan 09, 2013 at 11:39 UTC ( #1012447=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^2: Golf for unique digits
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.
Re^3: Golf for unique digits
by eyepopslikeamosquito (Canon) 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'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-09-18 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls