I have a array of hash refs. The date field in a hash is stored in epoch. I have to format it to human readable before returning the array. Following is my code:
for my $post (@sorted) {
$post->{date} = format_time($post->{date});
push @formatted, $post;
}
I have tried
my @formatted = map {$_{date} = format_time($_{date})} @sorted;
All fields except {date} are dropped.
Is there any smarter method?
Thanks
Then the dates in @sorted will have been converted.