#! perl -slw use strict; use Data::Dump qw[ pp ]; use XML::Simple; # open DATA, '<', 'stream'; my $enc = ; my $bot = my $top = ; $bot =~ s[^<(\w+).*][]s; my $section = ''; until( ( my $line = ) =~ m[$bot] ) { my( $tag ) = $line =~ m[<(\w+)]; my $end = ""; $section .= $line; $section .= until $section =~ m[$end\s*$]; my $ref = XMLin( $enc . $top . $section . $bot ); ## do something with this section pp $ref; $section = ''; } __DATA__ some stuff some stuff some stuff some stuff some stuff