Newsgroups: comp.lang.perl.misc
From: Rainer Weikusat <rweiku...@mssgmbh.com>
Date: Thu, 08 Nov 2012 21:33:19 +0000
Local: Thurs, Nov 8 2012 4:33 pm
Subject: Re: how does $#array work internally?
Helmut Tessarek <tessa...@evermeet.cx> writes:
NB: The description below is only true for 'real' arrays.
> On 08.11.12 13:33 , Rainer Weikusat wrote: >> Assuming that @array would be the array in question, you can get the > my bad, yes, 'array' is the name of the array.
>> number of elements by evaluating that in scalar context, eg
> it is a well-formed array (no holes), so I thought $#array (if using meta
Both calculations are done based on the structure member which holds
1. In Perl versions prio to 5.12, no intermediate 'magic SV' is
2. Calculating the number of elements is done by adding 1 to
NB: On the computer where I tested this, the difference was about
-------------------
my @a = 1 .. 200;
timethese(-5,
$l = @a;
last => sub {
$l = $#a;
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||