use strict; use warnings; use Time::Piece; use Data::Dumper; my $data = [ { Color => q{green}, Step => q{Platform}, acc => q{1111}, Date => q{08-06-2022}, }, { Color => q{black}, Step => q{Platform}, acc => q{1111}, Date => q{01-05-2019}, }, { Color => q{blue}, Step => q{Platform}, acc => q{1111}, Date => q{10-11-2020}, }, { Color => q{white}, Step => q{Platform}, acc => q{1111}, Date => q{01-03-2022}, }, { Color => q{red}, Step => q{Platform}, acc => q{1111}, Date => q{03-21-2021}, }, ]; my @filtered = ( map { delete $_->{ epoch }; $_; } sort { $a->{ epoch } <=> $b->{ epoch } } map { $_->{ epoch } = Time::Piece->strptime( $_->{ Date }, q{%m-%d-%Y} )->epoch(); $_; } @{ $data } )[ -1 ]; print Data::Dumper->Dumpxs( [ \ @filtered ], [ qw{ *filtered } ] );