in reply to How to find number of elements of an array from array reference

moritz is right. You can force an array into a scalar context using scalar(), but that is seldom necessary. For example, $asdad was assigned value 1 because the arguments to length() are in scalar context, so it is as though you had said length("3"), which is 1. If there had been 10 items in the array, you'd have a two-digit length, and $asdad would have been assigned 2.

  • Comment on Re: How to find number of elements of an array from array reference