in reply to Counting elements in array
I prefer the following
my @Array = (1,2,3,4); say 0+@Array; #@Array as a number)
Its clearer than
say scalar(@Array); #@Array as a scalar)If you just want to print the size, this is the simplest way.
print "size of array: " . @array . ".\n";All is well
|
---|
In Section
Seekers of Perl Wisdom