|Just another Perl shrine|
Re^2: Idiom to return 0 or random number of array elementsby LanX (Canon)
|on Dec 07, 2012 at 05:46 UTC||Need Help??|
@array[0 ..0] is one and not zero elements!
your statistical proof falls into the trap
scalar @array != scalar (LIST)
if your function() returns a one element list (0), then scalar function() will be 0, since 0 is the last element of the list.
(more detailed in Re^2: Idiom to return 0 or random number of array elements by eyepopslikeamosquito )
initializing @array = 1..10 makes it more obvious, b/c the last element of a sublist is now identical to the length!