DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Hans has posted 19 posts at DZone. View Full User Profile

Perl XML::Twig (very Simple Example)

  • submit to reddit
        Using XML::Twig

use XML::Twig;

my $xml = '<?xml version="1.0" ?>
<page id="1">
      This is <div class="red">some HTML text</div>

my $twig = XML::Twig->new(
  twig_handlers => {
    content => sub { $_->print; print "\n";  },