#!/usr/bin/perl
$a=5;
+ # Here we make a new variable called "a" to use as a simple loop co
+unter.
+ # Now, we'll create some arrays, and start them off with some fresh
+ elements.
@group=("swarm","heap","load","gang","squad","bunch","cluster","family
+","team"); # This is an array, called group. Arrays are designated wi
+th in at-symbol (@) prefix.
@adjective=("crack-smoking","supple","furious","sexy","hyperactive","i
+nquisitive","hot","old","crazy");
@noun=("midgets","Cuban refugees","clowns","bitches","programmers","ba
+bies","dogs","hep-cats","apes");
while($a>0)
+ # This is a simple while-loop construct. It uses the same syntax as
+ Java, or C,
{
+ # with one exception...You need to enclose even singular expression
+s in braces.
$index=rand(9);
+ # This generates a random integer between 0 and 9, and stores it in
+ $index
print( "\nMr. T says, \"Daaaaammmn!!! A @group[$index]");
+ # First part of the line is printed here, in this statement.
$index=rand(9);
+ # A new number is generated, and stored in $index.
print( " of @adjective[$index]");
+ # The n'th element ($index) of the array is printed here.
$index=rand(9);
+ # A new random number is generated and stored in $index.
print( " @noun[$index] just ate my balls!!\"");
+ # The end of the line is printed.
$a--;
+ # Our loop counter is decremented here, and the loop iterates.
}
print("\n\n");
+ # Toss in a few newlines to keep things pretty, and we're all done!
|