Are you saying you want to sort the numbers as if they are one long list, then put them back in pairs? For that the following should do what you want.
my @record;
open(FH,"abc1") or die "not open";
while (<FH>) {
chomp;
push @record,split(/,/,$_);
}
for my $idx (0..$#record) {
if ($idx % 2) {
print $record[$idx],"\n";
}
else {
print $record[$idx],",";
}