And here I thought it was just because 0 comes before 1 ;-)

On 27 Dec 2005, at 07:16, Adriano Ferreira wrote:

   I am curious what the reasoning behind the first element of
something being zero is ($array[0]).  I know I've read it before, but
I can't remember.  Thanks!

Using indices 0 .. n make it possible to work with them like offsets
from the beginning of the array. More important from a C point of
view, where it may even improve performance. Ah, and for loops are
shorter by one character ;)

for ( $i=0; $i<$n; $i++ ) { .. }

rather than

for ( $i=1; $i<=$n; $i++ ) { ... }

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to