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

Re: Apropos of nothing...

Thread Previous | Thread Next
From:
Damian Conway
Date:
December 13, 2001 12:42
Subject:
Re: Apropos of nothing...
Message ID:
200112132042.HAA05346@indy05.csse.monash.edu.au

   > > 	@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
there.

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

Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About