#!/bin/perl -w use strict; use XML::Twig; my $t= new XML::Twig( TwigHandlers=> { job => \&job}); $t->parsefile( 'T:\\BI\\Jerome\\xml\\tree.xml'); exit; sub job { my ($t, $job)= @_; my %job; $job{Attr_name}= join ':',map {$_->text || ''} @{[$job->children( 'Name')]}; $job{Attr_value}= join ':',map {$_->text || ''} @{[$job->children( 'Value')]}; print "$job{Attr_name}: $job{Attr_value}\n"; $job->delete; }