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.
- RFC 212 (v1) Make length(@array) work Perl6 RFC Librarian
- Re: RFC 212 (v1) Make length(@array) work Hildo Biersma
- Re: RFC 212 (v1) Make length(@array) work Bart Lateur
- Re: RFC 212 (v1) Make length(@array) work Nathan Torkington
- Re: RFC 212 (v1) Make length(@array) work Dave Storrs
- Re: RFC 212 (v1) Make length(@array) work Casey R. Tweten
- Re: RFC 212 (v1) Make length(@array) work Randal L. Schwartz
- Re: RFC 212 (v1) Make length(@array) work Nathan Torkington
- Re: RFC 212 (v1) Make length(@array) work Nathan Torkington
- Re: RFC 212 (v1) Make length(@array) work Casey R. Tweten
- Re: RFC 212 (v1) Make length(@array) ... Nathan Torkington
- Re: RFC 212 (v1) Make length(@ar... Nathan Wiger
- Re: RFC 212 (v1) Make length... Nathan Torkington
