#! /usr/bin/perl use strict; use warnings; use XML::Twig; my $file = $ARGV[0]; my $twig= new XML::Twig( TwigRoots=>{geography=>1}, TwigHandlers=> { 'node' =>\&geog_node } ); $twig->parsefile($file); sub geog_node { my($twig, $section) = @_; if($section->att('hidden') eq '0') { print"Data for node: \n"; print"\tID:\t",$section->att('id'),"\n"; print "\tDesc:\t",$section->first_child('description')->text,"\n"; } }