@sorted_refs = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [ int($_->{SP}/100)*100, $_] } @unsorted_refs;