in reply to data types
Whether you use hashes or arrays (or nested versions of them) really depends on how you want to access and use the data.
Hashes are referenced by a key, which is usually a word, whereas arrays are indexed by a number.
Imagine for a moment that your program keeps track of data for a car race. You could print out who was in the lead by referencing an array called $positions like this:-
print $position_driver[1];
Mansell
You could display what position a certain driver was in like this:-
print $driver_position{'Schumaker'};
2
Which you use depends which makes more sense to you.
You won't see much of a difference between them just from a declaration, you need to actually use them for that.
|
|---|