Send to a Friend

How do I accomplish this in Perl (details inside)?
I need to find a way to expand a hash (or some sort of database). As part of the program, the program generates numbers which need to be stored. I need to find a way so that, when I tell the program to generate another number, the program will make a new entry in the hash/database to enter that number into. If I told the program to make 50 numbers, it should still be able to tell me what the 5th, 12th, etc. numbers were.
Using Fluther
or