I seem to have come across several different ways to find the size of an array. What is the difference between these three methods?
my @arr = (2);
print scalar @arr; # First way to print array size
print $#arr; # Second way to print array size
my $arrSize = @arr;
print $arrSize; # Third way to print array size
转载于:https://stackoverflow.com/questions/7406807/find-size-of-an-array-in-perl