[Israel.pm] scalars and arrays

Yaakov Belch lists at yaakovnet.com
Sun Feb 15 05:12:15 PST 2004


>
>
>Is there any performance penalty using the wrong syntax ?
>Yossi
>  
>
I would expect some penalty.  I asked my computer:

time perl -we '$a[1]=1 while(++$i<1000000)'
time perl -we '@a[1]=1 while(++$i<1000000)'

You have to run these commands a few times because the first run is 
slower that the following runs
(The operating system caches recently accessed files).  On my machine, I 
got 1.020s user time for the
first example and 1.590s user time for the second example.

Yaakov





More information about the Perl mailing list