Subject: | Doesn't work on array of hashes |
This program says: "Can't call method "dtkeysort" on an undefined value"
use strict;
use warnings;
use autodie qw(:all);
use Error qw(:try);
use DateTime;
use Sort::Key::DateTime;
use Data::Dumper;
my @list;
push @list, { datetime => DateTime->today() };
push @list, { datetime => DateTime->today() };
push @list, { datetime => DateTime->today() };
@list = Sort::Key::Datetime::dtkeysort { $_->{'datetime'} } @list;
print Data::Dumper->new([\@list])->Dump();