On Tuesday, Nov 26, 2002, at 06:35 US/Pacific, Mystik Gotan wrote:
I can't really figure out what the purpose of wantarray() is.
Can someone please give me a good, decent explanation?
Thanks in advance :-)
my $scalar = funk(@args);
my @array = funk(@args);
if you use
return wantarray ? @array : split(/ /, @array)
then in the former case the $scalar will have all the
'fields' in one flat line. in the list context you
will have an array.
you've probably seen the
my ($name, $reality, $check, $thingie) = some_method(@args);
types of POD - that also tells you
my @answers = some_method(@args);
will provide a list context.... or a scalar context...
they do that because they are using the wantarray() in
resolving what to return.
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]