http://qs321.pair.com?node_id=1106082


in reply to localtime parse within hash init

FWIW - this is the code I finally settled on ..
my %opt = ( DEBUG => 0, OTHER_UNRELATED_OPT => "Other values", # snip 8< --- more params here ... LOCALHOST => $ENV{HOSTNAME} || $ENV{COMPUTERNAME} || $E +NV{HOST}, DATEFIELD => sub{ local $_={}; @$_{qw|sec min hour mday mon year wday + yday isdst|} =localtime(time); $_->{year}+=1900; $_->{mon}+=1; $_->{yyyymmdd} = sprintf "%04d-%02d-%0 +2d", @$_{qw|year mon mday|}; $_->{hhmm} = sprintf "%02d:%02d", + @$_{qw|hour min|}; return $_} # end of anon sub ->(), # Call the sub REMOTE_PARAMS => "", );
Thanks everyone !

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