Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Find maximum (Activity) date from array hash.

by CountZero (Bishop)
on Jun 02, 2020 at 20:08 UTC ( #11117608=note: print w/replies, xml ) Need Help??

in reply to Find maximum (Activity) date from array hash.

A few things:

  • You will have to dereference $_ : $_->{'Activity Date'}
  • = isn't a comparison operator, it is the assignment operator. Use == instead for numerical tests. But you really need eq to check if both dates are the same.
  • Finally, to see if one date is before or after another, you cannot use > or <. At least not if you use this date-format. The ISO date format (YYYY-MM-DD) can do that more easy. So either transform your date format into the ISO format of use one of the many Date or DateTime modules on CPAN.


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: Find maximum (Activity) date from array hash.
by Sami_R (Sexton) on Jun 02, 2020 at 23:41 UTC

    Thank you CountZero

    Based on your notes, have used hippo's code with ISO date format (YYYY-MM-DD) and compared the date like

    $maxdate = $date if $date gt $maxdate;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-12-07 19:45 GMT
Find Nodes?
    Voting Booth?

    No recent polls found