in reply to Moving around in a Schwartzian Transform in strict mode?
Not making the assumption that all of your lines are key=value but just that one of them looks like area=###.##, you could do this:
my @sortrecs = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { "@$_" =~ /area\s*=\s*([\d.]+)/; [ $_, $1 ] } @records;
I should note that this could break if you have multiple "area=###.##" strings in each record (because you'll only be sorting on the first one). Also the part that matches the number isn't too strict in that it will match something like 12.234.345 quite happily.
|
|---|