Alex Francis wrote:
> I finally got round to reading a little about Perl 6 - Gabor's blog
> post / mailout:
> 
> http://szabgab.com/blog/2009/06/1245228625.html
> 
> One thing that leapt out to me was this bit:
> 
> --quote--

> Instead of the quite ugly $#array notation used in Perl 5 (that
> returns the highest index in the array) fetching the number of
> elements of array is done in Perl 6 by the elems() function. Actually
> I think the object oriented writing is much nicer here:
>     use v6;
>     my @names = <foo bar baz>;
>     say elems @names;                   # 3
>     say @names.elems;                   # 3
> --end quote--

Personally I find @array in scalar context a nice way to get the
number of elements in Perl 5, though it is a bit too implicit for the
unfamiliar reader.  $#array is rarely useful.

-- Jamie
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to