next up previous contents index
Next: Declaring variables Up: Variables Previous: Hashes   Contents   Index


Random values

As an aside, often in testing out a program you don't care about particular values for a variable. If you want to just use random values, consider using the rand function: A handy snippet to stick in the back of your mind is that $array[rand @array]; will return a random element from an array @array - rand @array interprets @array to be the size of the array, takes a random number between 0 and the array size, and then automatically calls int on the result, since it only makes sense to have integer array indices.