It's a little difficult to guess what kind of things might be necessary to read Perl, but I think the most useful skill would be the ability to read variables and understand what kind of data structure is bring manipulated. Thus, I'd start with these three groups:
- Scalars, Arrays and Hashes
- Arrays of Arrays, Arrays of Hashes
- Hashes of Hashes, Hashes of Arrays
All this so that they can differentiate between
$foo,
$foo[0], and
$foo{'zero'}, as well as
$foo[0] and
$foo->[0]. (The latter expression can be written as
$$foo[0], but to me, that's much harder for the eye to pick up.)
Picking the correct data structure is a pretty critical piece in solving a programming challenge. I used three parallel arrays in a recent solution, and the code worked incorrectly -- so I had to take a step back and re-think, and finally realized I needed a HoA. The final code was really quite elegant, and was a breeze to write.
Alex / talexb / Toronto
Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.