|We don't bite newbies here... much|
Array indicesby Limbic~Region (Chancellor)
|on Sep 14, 2002 at 05:43 UTC||Need Help??|
Limbic~Region has asked for the
wisdom of the Perl Monks concerning the following question:
Several days ago in the CB, there was a discussion concerning the merits of 0 vs 1 based arrays. There was something that was said that bothered me - "if you are good, it doesn't matter if arrays are 0 or 1 based because you never need to use their index". I assume the person was referring to (pop, push, shift, unshift, [-1], $#, etc), which I use, but I was still offended. I may be new to Perl, but I have found instances where I need to use an index. For example, I have two different arrays that are related, but need to be kept separate. They are related by their indices. Consider the following:
I know this is a simplistic example, but it still requires using an index and knowing the base. I didn't say anything in the CB because I honestly felt that it wouldn't contribute to the 0 vs 1 discussion. It most likely would have spurred an unhealthy arguement.
As always, your insight and feedback is appreciated.