in reply to "Ate My Balls" Syntax Generator

Your script works as advertised, and the fact that it's wordier than necessary is obviously deliberate, so that beginners can follow it more easily. The one problem I *do* have with it is that there is no-reason to hard-code to number of elements in each list. Much better to use the $# construct to return the size of the list. In other words:
print "@groups[rand($#groups + 1)]\n";
will work even if you add or remove members from @groups.

Replies are listed 'Best First'.
RE: Ballsy coding
by Anonymous Monk on Apr 20, 2000 at 20:44 UTC

    Whoops, I'm new here and didn't realize comments were html-ized. That line of code should read:

    print "@groups[rand($#groups + 1)]\n";

    That is all.

      Hmm, even shorter to say: print $groups[rand(@groups)], "\n"; Did the OP mean to take an array slice?

      Or rather:

      print "@groups[rand($#groups + 1)]\n";

      Phew, a "preview post" button would've helped though...