in reply to Re^2: array of arrays
in thread array of arrays
I don't know what "cargo culting" means. I asked about a homework assignment because this problem didn't seem "real-world" to me. Your points about non-numeric, etc are well taken.
One thing that newbies often miss is the power of Perl list processing. Most of the common languages iterate over some array with an index variable array[$i]. In Perl the way is to iterate over all elements and the index doesn't matter. There is a lot of literature about "off-by-one" errors. Processing a Perl list avoids this problem - there is no "index" variable. It becomes: for everything in this list, do "X".
I would go as far as to say that as one's experience in Perl increases, the use of [$i] decreases. Now of course there are very valid reasons to use this type of statement! But in general a new Perl'er will overuse this. The use of the Perl hash is also often underused.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: array of arrays
by Limbic~Region (Chancellor) on Jun 29, 2009 at 14:36 UTC | |
by Marshall (Canon) on Jun 29, 2009 at 15:14 UTC |