develooper Front page | perl.perl5.porters | Postings from July 2004

Re: optimizing Short circuiting sort method based on [M]

Thread Previous | Thread Next
From:
Paul Fenwick
Date:
July 21, 2004 18:10
Subject:
Re: optimizing Short circuiting sort method based on [M]
Message ID:
40FF13F3.80702@perltraining.com.au
G'day David / P5P,

david nicol wrote:

>>Eh? what would wantarray return a ref to in
>>
>>    sub f { wantarray() ... }
>>    ($a, $b, @c) = f();
> 
> an array of aliases to $a, $b, and $c:
> 
>       [${\$a},${\$b},${\$c}]

So what do we do in the case of:

	print f();

wantarray() should clearly by true, but there are no variables that we 
can alias.

This could be worked around by creating an alias to a transient 
anonymous variable, which is then passed to print upon completion. 
However I'm not sure if we can do that without losing performance.

Cheerio,

	Paul

-- 
Paul Fenwick <pjf@perltraining.com.au> | http://perltraining.com.au/
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

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