This can be solved with a special case of the Schwartzian Transform.
How do I sort an array by (anything)
use strict;
use warnings;
my %pos2base2bin = (
'315' => { '8' => 0 },
'329' => { '6' => 0 },
'352' => { '5' => 0 },
'390' => { '1' => 0 },
'280' => { '7' => 1 },
'360' => { '9' => 0 },
'349' => { '4' => 0 },
'305' => { '10' => 0 },
'380' => { '3' => 1 },
'251' => { '2' => 0 }
);
my @file1 =
map {$_->[1]}
sort {$a->[0] <=> $b->[0]}
map {[each %$_]}
values %pos2base2bin;
$"= "\t";
print "file1 @file1\n";