in reply to Re: variable number of lists
in thread variable number of lists

See also the ARRAYS OF HASHES discussion in perldsc, which seems to have an example that is fairly close to your needs.

Good luck with your homework!

Update: The Arrays and hashes only with references tutorial may also be helpful.