Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: localtime parse within hash init

by NetWallah (Canon)
on Nov 04, 2014 at 15:53 UTC ( #1106061=note: print w/replies, xml ) Need Help??


in reply to Re: localtime parse within hash init
in thread localtime parse within hash init

thanks roboticus (++).

That leads to:

perl -E 'my %stuff=(otherinfo=>"this and that", dateinfo=> sub{ my %r; @r{qw|sec min hour mday mon year wday yday isdst|} =localtime(time); return \%r}->()); say "sec=",$stuff{dateinfo}{sec}, " year=",$stuff{dateinfo}{year}'
Which works, is pretty decent, and free of external modules.

        "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-08-12 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?