your print statements are equal.
There still seems to be a problem with the print statement because:
c:\@Work\Perl\monks>perl -wMstrict -le
"use feature 'say';
use DateTime;
my $d1 = DateTime->new(
year => 1999,
month => 8,
day => 1,
time_zone => 'America/Chicago',
);
my $d2 = DateTime->new(
year => 2019,
month => 6,
day => 8,
time_zone => 'America/Chicago',
);
say DateTime->compare( $d1, $d2 )
? $d1->ymd .' is greater than ' . $d2->ymd
: $d2->ymd .' is greater or equal to ' . $d1->ymd;
"
1999-08-01 is greater than 2019-06-08
Maybe something like:
c:\@Work\Perl\monks>perl -wMstrict -le
"use feature 'say';
use DateTime;
my $d1 = DateTime->new(
year => 1999,
month => 8,
day => 1,
time_zone => 'America/Chicago',
);
my $d2 = DateTime->new(
year => 2019,
month => 6,
day => 8,
time_zone => 'America/Chicago',
);
;;
my $comparison = DateTime->compare($d1, $d2);
$comparison = $comparison > 0 ? 'greater than' :
$comparison < 0 ? 'less than' :
'equal to';
;;
say sprintf '%s is %s %s', $d1->ymd, $comparison, $d2->ymd;
"
1999-08-01 is less than 2019-06-08
Give a man a fish: <%-{-{-{-<