develooper Front page | perl.perl6.language | Postings from December 2001

Re: Apropos of nothing...

Thread Previous | Thread Next
Damian Conway
December 13, 2001 12:42
Re: Apropos of nothing...
Message ID:

   > > 	@ary[0] =()= foo();	#   "      "     "  "  "   "    "      "
   > Hm, thats a change from perl5. In perl5 that would assign the number of
   > elements returned from foo(). Is there a good reason for this change ?

Firstly, Larry may have to rule on which behaviour actually *is* invoked

Secondly, my understanding was that arrays/lists (and there will be less
distinction between the two in Perl 6) will *always* enreference in 
scalar contexts, including here.

If you want the number of elements, you'd write:

	@ary[0] = foo().length();	# explicit request for length
	@ary[0] = +[foo()];		# numerification produces length


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About