On Thu, Aug 18, 2011 at 20:45, Alan Young <[email protected]> wrote:
> On Thu, Aug 18, 2011 at 18:19, Daniel Dilts <[email protected]> wrote:
>> The real question is how many statements are in your program.  You get extra
>> credit for writing the whole thing in one statement.
>
> $ cat<<<"$(seq 1 100)"|perl -0777 -pe
> 's/(\d+)/$1%15==0?"FizzBuzz":$1%5==0?"Buzz":$1%3==0?"Fizz":"$1"/ge'

It just occurred to me that the -0777 is unnecessary, so this will work as well

$ cat<<<"$(seq 1 100)"|perl -pe
's/(\d+)/$1%15==0?"FizzBuzz":$1%5==0?"Buzz":$1%3==0?"Fizz":"$1"/ge'
-- 
Alan Young
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to