On Wed, 13 Sep 2000 08:37:57 +0100, Hildo Biersma wrote:

>> Make length(@array) work
>
>Counter-proposal: make length(@array) a syntax error. I don't feel like
>rewarding stupidity, I'd rather teach people how to do things properly.

Indeed. What about lists?

        print length(qw(a b c));

Should this return 3?

If so, what will this return?

        print length('abc');

Is the argument not a list of one item? So, should this print 1, or 3?

Note that similar functions that work on both scalars and lists, such as
reverse(), use the context in which it is called. so,

        print reverse 'qwerty';

will still print 'qwerty', while

        print scalar reverse 'qwerty';

prints 'ytrewq'.

Note that this trick can't be used here, because length() only returns a
scalar.

-- 
        Bart.

Reply via email to