While we're in this part of the code, we could also reduce Perl warnings in the logs (currently: "Use of uninitialized value in string comparison (cmp) at ...") by swapping the order of the sort + grep:
grep { defined $row->{$_} } ( sort {$row->{$a} <=> $row->{$b}} keys %$row )
becomes:
sort { $row->{$a} <=> $row->{$b} } ( grep { defined $row->{$_} } keys %$row )
While we're in this part of the code, we could also reduce Perl warnings in the logs (currently: "Use of uninitialized value in string comparison (cmp) at ...") by swapping the order of the sort + grep:
grep { defined $row->{$_} } (
sort {$row->{$a} <=> $row->{$b}} keys %$row
)
becomes:
sort { $row->{$a} <=> $row->{$b} } (
grep { defined $row->{$_} } keys %$row
)