in reply to Re: localtime parse within hash init
in thread localtime parse within hash init
Stackoverflow to the rescue!.
This works:
From the article ....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}'
... They technically don't need to be named, just dereferenced. e.g. @$ref and @{qw( foo bar )} work just as well as @a. In other words, it has to start with @ (and not be a slice). (ikegami)
Update:Loops(++) answered identically, at the same time I discovered this.
"You're only given one little spark of madness. You mustn't lose it." - Robin Williams
In Section
Seekers of Perl Wisdom