in reply to The day of today

when declaring multiple variables on one line, you should put them in parantheses.

my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime;

Replies are listed 'Best First'.
Re: The day of today
by gtrain (Novice) on Mar 07, 2008 at 17:13 UTC
    Thanks all .... that looks much nicer to just specify the nth item in the array which localtime() has been sent to. Cheers!! gtrain

      If you take the route of specifying the offset, I would recommend using a constant instead of a magic number. It makes thins a tad easier to read.

      use constant DAY_OF_MONTH => 3; my $day = (localtime)[DAY_OF_MONTH]; print "Day is @{ [ ( localtime )[DAY_OF_MONTH] ] }\n";

      While I like the hackishness of the @{[()[]]} approach to forcing interpolation of executing code, I think it's too unweildy--it's hard to type and hard to read. If you really want to go this route, check out Interpolation--an interesting module that started out as a joke.


      TGI says moo