By that point in the code, there are no negatives anyway
No.
Here, I think this is what you want:
for my $aref_acc_num (sort { $a->[0] cmp $b->[0] } values %$acc_num) {
push @$all_dta_acc_num, my $tmp = [];
for my $aref (@$aref_acc_num) {
for my $i (0..1) {
$tmp->[$i] = $aref->[$i];
}
for my $i (2..$#$aref) {
if (!defined($tmp->[$i])) {
$tmp->[$i] = $aref->[$i];
} elsif ($tmp->[$i]=~m/^[+-]?\d+$/) { #numeric
$tmp->[$i] = $aref->[$i] if $aref->[$i] > $tmp->[$i];
} else {
$tmp->[$i] = $aref->[$i] if $aref->[$i] gt $tmp->[$i];
}
}
}
}