[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] wantarray() Function Question



In response to a question from sleidy@voicenet.com:
At 7:31 PM -0800 1/12/00, blm@halcyon.com wrote:
>|my(@the_Time) = &hms();
>|my($the_Time) = &hms();
>
>Read the "Private Variables via my()" section in perlsub.pod while thinking
>about the above lines.
>

But don't stare too hard at the 'my' part of it. The point is that having
the scalar $the_Time in my's parentheses (at the time you assign the value
from &hms() to it) makes it an element in an array, so wantarray() returns
true...

Here's the output when you change the statement to  my $the_Time = &hms() :


Array - hms()
The Time is Hour: 20, Minutes: 51,
Seconds 44.

String - hms()
The Time is  20.51.44.



Do read the pod, though. Much to gain.



- Bruce

__Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org