Thomas H. George wrote:
What is $dow in the line from Alpaca, p77:

my ($sec, $min, $hour, $day, $month, $year, $dow) = localtime;

_D_ay _O_f the _W_eek


Curious, I wrote


#!/usr/bin/perl -w

use strict;
use Time::Local;

Time::Local is not being used in your code so there is no need to include it.


use File::Find;

my ($sec, $min, $hour, $day, $month, $year, $dow) = localtime;
print "Day $day Month ", $month + 1, " Year ", $year + 1900, "\n";
print "Dow $dow\n";
print localtime, "\n\n";
my @numbers = grep (//,localtime);

grep (//,localtime) does *nothing* in your example, that should be:

my @numbers = localtime;


*BUT*, if you had used a regular expression before this line then a regular expression of // would use the previous regular expression, for example:

$data =~ /hello\s+(\d+)/;
my @numbers = grep (//,localtime);

Would be interpreted by perl as:

$data =~ /hello\s+(\d+)/;
my @numbers = grep (/hello\s+(\d+)/,localtime);


for (@numbers) {
        print $_, "\n";
}
and found there are actually three numbers following the number for the year. The man page for Time::Local makes no mention of these.

perldoc -f localtime
[snip]
          $wday is the day of the week, with 0 indicating Sunday and 3
          indicating Wednesday.  $yday is the day of the year, in the
          range 0..364 (or 0..365 in leap years.)



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to