Dave Mitchell wrote:

> On Tue, Feb 18, 2003 at 10:06:29PM -0000, Smylers wrote:
> 
> > More practically, the length of a list is never interesting: a list
> > by definition must be hardcoded into the program so its length is
> > known at compile time.
> 
> Err, no.  Eg in perl 5:
> 
>     $value = (1,2, @ARGV,3,4)[$i]
> 
> That's a list, and its length is not known at compile time.

Ooops, yes.  I was overstating the case that a list's length must be
known at compile time.  But I'd still maintain that the length isn't
interesting.  In your example you are picking out a particular element,
which is reasonable and I've got no objection with that.

What I don't understand is why a list in numeric context should yield
its length, and that still applies to your example.  There's no
advantage in doing:

  $length = 1 + (1, 2, @ARGV, 3, 4);

over the much more straightforward:

  $length = 5 + @ARGV;

Smylers

Reply via email to