in reply to Re: Calculate difference between multiple days
in thread Calculate difference between multiple days

Hello all and thank you for your kind replies!
I actually meant an all-against-all comparison, but I think I will go for something like this:
#!/usr/bin/env perl use strict; use warnings; my $date_first = '2005-09-27'; my $date_second = '2019-12-22'; my $date_third = '1999-12-22'; use Time::Piece; my $date1 = localtime( $date_first ); my $date2 = localtime( $date_second ); my $date3 = localtime( $date_third ); if( $date2 > $date1 and $date2 > $date3 and $date1 > $date3) { print "correct\n"; }

since I just needed to only compare between them and not calculate days. This works for me now, thanks again!

Replies are listed 'Best First'.
Re^3: Calculate difference between multiple days
by hippo (Archbishop) on Oct 25, 2018 at 10:10 UTC
    if( $date2 > $date1 and $date2 > $date3 and $date1 > $date3)

    Can you spot which of these three comparisons is redundant?