$data->{$area_name}{$track_num}{coordinates}{$key}{lat} = [@lat]; $data->{$area_name}{$track_num}{coordinates}{$key}{long} = [@long];
foreach my $area (sort keys %{$data}) { my $area_folder = $dom->createElement('Folder'); $areas_folder->appendChild($area_folder); ... }