in reply to multidimensional arrays
One trick novice programmers all seem to try at least once (not addressing nascent here, but taking the opportunity to step up on a soapbox) is creating variable and object names like Car1, Car2, and Car3. They go through manipulations like: ${"Car$i"}->{color} = "blue"; This can introduce subtle bugs as you're depending on a lot of things being correct to get and to set your variable. (In my example, use an array: @cars.) Now you have only one place to go to get or set your car properties. You know the index for first element and can get the index for the last element with ease. Best of all, if you use strict and -w, Perl will catch any typos for you.
|
|---|