$kmlfile = "1.0001,2.0002,0 3.0003,4.0004,0 ..."; if ($kmlfile =~ m{(.*)}g) { $coordinates = $1; while ($coordinates =~ m/\G(\d*\.\d*,\d*\.\d*),0*/s*/gs) { push @coords, $1; } } #### $coords[0] = 1.0001,2.0002; $coords[1] = 3.0003,4.0004; ...
## $coords[0] = 1.0001,2.0002; $coords[1] = 3.0003,4.0004; ...