my @sorted_list = map { $database_in[ $$_[0] ] } sort { $$a[1] cmp $$b[1] } map { [ $_, (split /\t/, $database_in[ $_ ])[3] ] }(0..@database_in-1);