Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: printing element of anonymous array

by haukex (Archbishop)
on Mar 04, 2018 at 12:03 UTC ( [id://1210311]=note: print w/replies, xml ) Need Help??


in reply to Re: printing element of anonymous array
in thread printing element of anonymous array

Just for TIMTOWTDI, Time::gmtime has been in core ~10 years longer:

use Time::gmtime; print gmtime->wday;

But there is a difference: Time::Piece's wday index is 1-based (1=Sunday) while gmtime and Time::gmtime's wday is 0-based (0=Sunday).

Replies are listed 'Best First'.
Re^3: printing element of anonymous array
by 1nickt (Canon) on Mar 04, 2018 at 17:24 UTC

    True, but there's a reason Time::Piece was placed in core, and it ain't because Time::gmtime had feature bloat.

    Besides the aforementioned wday(), which provides a one-indexed numerical value for the day of the week, Time::Piece also provides _wday() and day_of_week() for getting the zero-indexed value, as well as fullday() to get the full name of the day, and day() and wdayname() for an abbreviated version of the name.


    The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1210311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found