use strict; use warnings; use XML::LibXML; local $/ = "\n\n"; my $doc = XML::LibXML::Document->createDocument(); my $root = $doc->createElement("body"); $doc->setDocumentElement( $root ); while ( my $para = ) { chomp $para; my $p = $doc->createElement("p"); my $txt = $doc->createTextNode( $para ); $p->appendChild($txt); $root->appendChild($p); } print $doc->serialize(1); __DATA__ Some arbitrary text > some fixed text & that's okay. XHTML is fun with L.