#!/usr/bin/perl use strict; use warnings; use XML::Smart; my $sitemap = XML::Smart->new(); $sitemap=$sitemap->{'urlset'}; push(@{$sitemap->{'url'}}, {loc => "http://www.example.com/page1.html", lastmod => "2013-11-20"}); push(@{$sitemap->{'url'}}, {loc => "http://www.example.com/page2.html", lastmod => "2013-11-21"}); print $sitemap->data(), "\n";