use strict; my @sortrecs = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, (split /area\s+=\s+/,$_->[9])[1] ] } @records;