# File: randArray.pl # Title: Generate a random student from a set of students # Author: Mihaela Malita # Generates a random student from= annbobcaradan # Position is: 1 # Random student: bob @Students = ('ann','bob','cara','dan'); # declare array students print "Generates a random student from= ", @Students; $len = @Students; # length array students = 4 $i = int rand($len); # generates random 0 <= integer < L print "\nPosition is: ",$i; # random position in array print "\nRandom student: $Students[$i]"; exit