in reply to Re: The day of today
in thread The day of today

Thanks all .... that looks much nicer to just specify the nth item in the array which localtime() has been sent to. Cheers!! gtrain

Replies are listed 'Best First'.
Re^2: The day of today
by TGI (Parson) on Mar 07, 2008 at 18:41 UTC

    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