#!usr/bin/perl #use strict; use warnings; use XML::TreeBuilder; #use XML::Parser; #use Data::Dumper; my $root= XML::TreeBuilder->new(); $root->parsefile('weateg.XML'); #print Dumper($root); my @observation=$root->look_down(_tag=>'date'); foreach my $h (@observation) { printf "%s: %d-%d-%d %d:%d\t", $h->attr('date'), $h->look_down(_tag => 'year')->as_text,$h->look_down(_tag => 'mon')->as_text,$h->look_down(_tag => 'mday')->as_text,$h->look_down(_tag => 'hour')->as_text,$h->look_down(_tag => 'min')->as_text; }