Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Get most recent data based on a date from an array of hashes.

by tybalt89 (Monsignor)
on Jan 19, 2022 at 16:38 UTC ( [id://11140616]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    my @mostrecent = max_by {join '', (split /-/, $_->{Date})[2,0,1] } @$d
    +ata;
    
    use Data::Dump 'dd'; dd @mostrecent;
    
  2. or download this
    (
      { acc => 1111, Color => "green", Date => "08-06-2022", Step => "Plat
    +form" },
      { acc => 1111, Color => "white", Date => "08-06-2022", Step => "Plat
    +form" },
    )
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found