I think people here lost track of the fact that your example is only contrived. I do agree with them that your example is a good one to show where you wouldn't need indices if you were clever in the first place.
Sometimes, it is true, you can't do without an index. However, a lot of the time you can. Consider "lot" to be something in the 95% range. Very rarely is there a need to access elements by index with Perl's innate understanding of what a list is.
Basically, it boils down to data structure layout. There's a saying by one of the CS greats along the lines of:
Show me your flow charts, but conceil your data structures. I will be mystified. Show me your data structures, but withhold your flow charts, and I won't need them for they will naturally follow.
(I'd be eternally grateful if someone could identify the originator and tell me the exact phrasing, btw.)
You may want to have a look at Dominus' Program Repair Shop and Red Flags article series on Perl.com for some practical but generalized advice.
Makeshifts last the longest.
In reply to Re: Array indices
by Aristotle
in thread Array indices
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |