Friday, September 06, 2013

Interesting fact about finding perl array size

Recently, I came across a problem with Perl array. I was assuming that these three methods generate same output for finding array size, but I am WRONG :

my @newArray = (2);
print scalar @newArray;   #1
print $#newArray; #2
print @newArray; #3

First and third give me proper values, but second gave me 0 size. So be careful, while using it. I would recommend using "scalar @newArray".

Here is some explanation on it :


1 comment:

o97g14f4p2 said...

This is partly as a result of} value (the beginning value for a primary 3D printer is about $300), but additionally the small measurement of the printers comparability with} traditional manufacturing. For printing production parts, speed and value are also necessary, but the characteristics most commonly exploited are design freedom and ease of customization. In aerospace and automotive, topology optimized buildings with a high strength-to-weight ratio are used Double Sided Tape for high-performance parts, and parts that beforehand required assembly may be consolidated into a single part. In healthcare, customization is important - most listening to aids manufactured in the US are made virtually exclusively using 3D printing.