#!/bin/perl -w use strict; use XML::Twig; # create and load the twig (with pretty_print option) my $twig= new XML::Twig( pretty_print => 'indented'); $twig->parse( \*DATA); # get the insertion spot, you could also use the get_xpath method my $insert= $twig->root->first_child( 'insert'); # parse the text into a twig element my $text="
this is a paragraph with some