In the summary of differences between Perl 5 and Perl 6, it is noted that the wantarray function is gone:
wantarray() is gone
wantarray is gone. In Perl 6, context
flows outwards, which means that a
routine does not know which context it
is in.Instead you should return objects that
do the right thing in every context.
Could someone provide an example of how such an object is created?
I think 2 examples might be:
http://perlcabal.org/syn/S13.html#Type_Casting
Also, I think this might be relevant though less so: http://perlcabal.org/syn/S12.html
Search for:
So you return an object which has several context-specific accessors.
Interestingly enough, it started out with Perl6 replacing “wantarray” with a generic “want”: RFC 98 (v1) context-based method overloading, circa 2000, also at http://dev.perl.org/perl6/rfc/21.html . I’m not sure why/when the change was made.