I would like to sort this array based on the value after the comma
my @coords;
$coords[0] = "33.7645539, -84.3585973";
$coords[1] = "33.7683870, -84.3559850";
$coords[2] = "33.7687753, -84.3541355";
foreach my $coord (@sorted_coords) {
print "$coord\n";
}
Output:
33.7687753, -84.3541355
33.7683870, -84.3559850
33.7645539, -84.3585973
I've thought about using map, grep, and capture groups as the list input for sort, but I haven't gotten very far:
my @sorted_coords = sort { $a <=> $b } map {$_ =~ /, (-*\d+\.\d+)/} @unique_coords;