Example 3: code
-
#!/usr/bin/perl
-
use strict use warnings use XML::Twig;
-
my $CATALOG_FILE = "plant_catalog.xml" my $UPDATE_FILE = "updates.xml";
-
my $updates= XML::Twig->new->parsefile( $UPDATE_FILE);
-
my $catalog= XML::Twig->new( # element => subroutin twig_handlers => { plant => \&plant, } pretty_print => 'indented' );
-
$catalog->parsefile( $CATALOG_FILE) $catalog->flush;
-
exit;