robin <> writes:
> On 04-Aug-2011 3:30 PM, George Mpouras wrote:
>> $#array
>> scalar @array or
>> my $n = @array ?
> I assume with strict the my one with work faster, I think the strict
> pragma makes it faster perl.
According to the corresponding documentation, access to 'my' variables
should be faster than acceses to 'other variables' and I expect this
to be actually true because a variable declared with my reside in a
scope-specific array and are accessed by array index while 'package
globals' require a hash lookup in the symbol table hash of the package
they belong to. But that's not at all related to 'strict' which
reconfigures the Perl compile by modifying the variable $^H and has no
runtime effects. (AFAIK).
|