Re: `$#array` vs `scalar @array`

2018-01-28 Thread Chas. Owens
$#array is the index of the last element of @array, so it will be one less than scalar @array which is the number of elements in @array (since Perl arrays start with index 0). Therefore, to get the number of elements, you would need to add one to $#array, which makes scalar @array faster. To get th

`$#array` vs `scalar @array`

2018-01-28 Thread Peng Yu
Hi, For the following two expressions, are they of the same speed or one of them is faster? `$#array` vs `scalar @array` -- Regards, Peng -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/