in reply to Re: Some Insights from a Traveler Between Languages
in thread Some Insights from a Traveler Between Languages

I have two reasonably short potential equivalents to your list() function. Which of these do you want? Remember that it will should work the same for all arguments, so the fact that we're using localtime here is irrelevant.
my ($n) = localtime;
or
my $n = (localtime)[-1];
Context is given by the left hand side of an assignment, but its interpretation is done by the right hand side.

update: also note that the current interpretation of scalar context by a list means that the last element is returned, wich would mean that your list() function would act like:

(1,2,3,4) != list(1,2,3,4);

Replies are listed 'Best First'.
Re^3: Some Insights from a Traveler Between Languages
by tlm (Prior) on Apr 23, 2005 at 23:29 UTC

    Neither. As I showed in my original post, after

    my $n = list localtime;
    $n should end up with 9.

    the lowliest monk