use XML::Simple; my $xml = XMLin(join('',),ForceArray => 1); print XMLout($xml); __END__ 1-234-56789-0 First John Smith 384 October 2001 some.lame.subject another.lame.subject Publisher Inc. Publisher Inc.