>Perl 6 Beginners list <[EMAIL PROTECTED]>
^^^ ahem?
At 11:13 AM 3/28/02 -0800, Dave Storrs wrote:
>Executive summary: It looks like, no matter what context foo() is called
>in, its arguments are always evaluated in list context. Is this correct?
Unless a prototype overrides it, yes. For instance, sprintf has an
implicit prototype that says it expects a scalar as its first argument:
% perl -le 'sub foo{ print wantarray ? "list" : "scalar" }; sprintf(foo)'
scalar
>I had always understood that:
> - a function's arguments were evaluated in the same context as the
>context of the function (hmm...actually, thinking about it, this seems
>like it can't be right. Is it simply always LIST, or can it vary?)
For builtins, look at the signature in perlfunc. For your own functions,
use a prototype to change it from LIST. In general, you need a good reason
to do this.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]