On Jan 29, Mayank said:

>Shouldn't PERL support the array index nomenclature as in shell
>scripting in place of C's syntax. After all it's more intutuive.

I'm afraid I don't know what you mean.  Are you asking why Perl arrays do
not start at 1?

There is precedence for 0-based arrays, based on the way we think
computers "think".  The first element of an array is element 0, because
that number (the "index") refers to its offset from the beginning of the
array -- that is, how many elements are before it.

If you feel like a curmudgeon, you can say:

  $[ = 1;

and then all your arrays will start at 1.  But anyone who sees you doing
that in your code is likely (and for good reason!) to shun you and/or your
code.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to