|Perl Monk, Perl Meditation
2d arrays in Perl?by jotti (Scribe)
|on Aug 21, 2002 at 08:18 UTC
jotti has asked for the wisdom of the Perl Monks concerning the following question:
I'm not very familiar with Perl, yet. I would like to construct a 2d array which will store data about pupils in our school. We have a number of pupils and for each pupil I want to store Name, ClassID, a variable number of CourseCodes.
In C++ I would create a class, because Name and ClassID would be strings and CourseCodes would be a dynamic array of some kind. Should I go OO in Perl, too, or is it possible to do something like:
This would store classID 99-A to the 23:rd pupil in the array.
This should store the 23:rd pupil's all course codes in an array for further processing.
I've tried these lines, but I get different errors. How should I declare the whole array?