Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: localtime parse within hash init

by NetWallah (Canon)
on Nov 04, 2014 at 06:35 UTC ( [id://1105977]=note: print w/replies, xml ) Need Help??


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

Thank you (++) - no - I was not aware of zip/mesh in List::MoreUtil.

However, my attempt at using it fails:

perl -MList::MoreUtils -E 'my %stuff=(otherinfo=>"this and that", dateinfo=>{List::MoreUtils::zip qw|sec min hour mday mon year wday yday isdst| ,localtime(time) }); say "sec=",$stuff{dateinfo}{sec}, " year=",$stuff{dateinfo}{year}' Type of arg 1 to List::MoreUtils::mesh must be array (not list) at -e +line 5, near ") }" Type of arg 2 to List::MoreUtils::mesh must be array (not localtime) a +t -e line 5, near ") }" Execution of -e aborted due to compilation errors.
Any workarounds ? Why does it not like a list ?

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

Replies are listed 'Best First'.
Re^3: localtime parse within hash init
by Loops (Curate) on Nov 04, 2014 at 06:49 UTC
    zip(@{[qw|sec min hour mday mon year wday yday isdst|]} , @{[localtime +]});

      Hi Loops,

      thank you for showing the right way to call it. I had to lough. In this case we really have a kind of 'sigilmania'. I'm not sure whether this is more elegant. ;-)

      Regards
      McA

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-19 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found