[Cialug] Shotgun?

David W. Body davidbody at bigcreek.com
Mon Aug 15 09:16:11 CDT 2005


#!/usr/bin/ruby -w
require 'date'
puts Date::DAYNAMES.slice(1..5)[rand(5)]

On Aug 14, 2005, at 8:22 PM, Renegade Muskrat wrote:

> What was the "for" loop for on your version of the script? Just as  
> an exercise i thought i'd see how small i could get a perl program  
> that picks a weekday and prints it. It is below. If anyone can  
> think of a way to do it even smaller, let me know.
>
> #!/usr/bin/perl -w
> print "",qw(Monday Tuesday Wednesday Thursday Friday)[5*rand],"\n"
>


More information about the Cialug mailing list