in reply to Get the length of a list.

if all you want is the length of an array, why not?

print $#;

Replies are listed 'Best First'.
Re^2: Get the length of a list.
by LanX (Saint) on Jul 27, 2013 at 16:41 UTC
    Lists are not arrays!

    see FAQ#What is the difference between a list and an array?

    for instance the easiest way to know how many values a function or a grep returned is using a goatse:

    DB<101> sub tst {a..z} DB<102> $length =()= tst() => 26 DB<107> grep { $_ % 2 } 1..10 => (1, 3, 5, 7, 9) DB<108> $n =()= grep { $_ % 2 } 1..10 => 5

    Cheers Rolf

    ( addicted to the Perl Programming Language)