[DFW.pm] Fizzbuzz assignment

Sriharsha Vedurumudi sriharsha at vedurumudi.com
Thu Sep 11 15:09:47 PDT 2014


Got a compile error  when trying to run this.
But this worked (81 chars though)

map{print 
"".($_%15)?($_%3)?($_%5)?"$_\n":"Buzz\n":"Fizz\n":"FizzBuzz\n"}(1..100)

-Sri

On 09/11/2014 05:35 PM, Andrew Sohn wrote:
> Here's my Fizz Buzz golf attempt... :)
>
> print$_%3?'':Fizz,$_%5?'':Buzz,$_%3&&$_%5?$_:'',"\n"for 1..100
> 63 characters
>
> On Thu, Sep 11, 2014 at 4:30 PM, Rob Eaglestone 
> <robert.eaglestone at gmail.com <mailto:robert.eaglestone at gmail.com>> wrote:
>
>     Pounding one's head on the keyboard repeatedly again, I see.
>
>     On Thu, Sep 11, 2014 at 4:12 PM, Christopher Spencer
>     <chris at crspencer.com <mailto:chris at crspencer.com>> wrote:
>
>         map{if(!($_%3)){print"Fizz"}if(!($_%5)){print"Buzz"}if($_%3&&$_%5){print"$_"}print"\n"}(1..100)
>
>
>         97 characters. 1 line.
>
>         -- Chris
>
>         _______________________________________________
>         Dfw-pm mailing list
>         Dfw-pm at pm.org <mailto:Dfw-pm at pm.org>
>         http://mail.pm.org/mailman/listinfo/dfw-pm
>
>
>
>     _______________________________________________
>     Dfw-pm mailing list
>     Dfw-pm at pm.org <mailto:Dfw-pm at pm.org>
>     http://mail.pm.org/mailman/listinfo/dfw-pm
>
>
>
>
> _______________________________________________
> Dfw-pm mailing list
> Dfw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/dfw-pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140911/59d2999e/attachment.html>


More information about the Dfw-pm mailing list