On Oct 27, John W. Krahn said:

>> So what did "localtime[4]" (without parens) do?
>
>my $x = localtime[4];
>
>Is the same as:
>
>my $x = localtime;
>
>Which assigns the scalar value of localtime to $x.  The [4] part is
>ignored.

No, it is not ignored.  localtime() takes an argument -- a number of
seconds.  References (such as \$x, \@y, \%z, and [4]) return a number in
numerical context.

  $x = localtime[4];

is the same as

  $x = localtime(0 + [4]);

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to