Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by AnomalousMonk (Archbishop)
on Jan 19, 2022 at 21:38 UTC ( [id://11140622]=note: print w/replies, xml ) Need Help??


in reply to Re: Get most recent data based on a date from an array of hashes.
in thread Get most recent data based on a date from an array of hashes.

my @filtered = ( ... )[ -1 ];

Since the @filtered array cannot be more than a single element, wouldn't it be better to make this a scalar?
    my $most_recent = ( ... )[ -1 ];

This would have the possibly desirable side effect that if the input array were empty, $most_recent would be undefined/false. (It must be defined/true otherwise because it would be a reference.)


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found