#! /usr/bin/perl -w use strict; use XML::Twig; my $twig= new XML::Twig( TwigHandlers => {town => \&town} ); if( my $file= $ARGV[0]) {$twig->parsefile( 'datafile_towns.xml'); $twig->flush;} sub town { my ($twig, $town) = @_; if (my $townx($town->first_child('location')->first_child('mapx'))>500){ print $town->first_child('towndata')->first_child_text('townname'), ',', $town->first_child('player')->first_child_text('allianceticker'), ',', $town->first_child('player')->first_child_text('playername'), ',', $town->first_child('towndata')->first_child_text('townname'), ',', $town->first_child('location')->first_child_text('mapy'), ',', $town->first_child_text('location')->first_child_text('mapx'), print "\n"; }; $twig->flush; }