in reply to Re: Re: Golfing the day of Christmas
in thread Christmas Coding Blues
jynx, your sub does not even return the correct answer the first time, if $b has been set elsewhere -- you rely on it to be numerically zero initially. Moreover, you will get a 7, not a 0, for Sundays ... so on the whole, I can't say I like it.
That is not to say my answer cannot be trimmed down. Indeed, I just did. And just so as not to leave your suggestion as the best (sorry; I really don't like it), I trimmed it to 46 chars:
Comparing that to my first suggestion ... can you tell I really like the ternary operator? ;-)sub f { # 1 2 3 4 5 #234567890#234567890#234567890#234567890#234567890#23 $b+=!($_%4||/00$/&&$_%400)for 0..($b=pop);$b%7 }
The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"
|
|---|