text text]]> #### #!/usr/bin/perl -w use strict; use XML::Twig; my $tag= shift @ARGV; my $att= shift @ARGV; # without the sprintf the expression looks real ugly # because of the interferences between XPath and Perl # syntaxes: "$tag\[\@$att]" my $path= sprintf( "%s[@%s]", $tag, $att); my $t= XML::Twig->new( start_tag_handlers => { $path => sub { print $_[0]->original_string, "\n"; }}); $t->parsefile( shift @ARGV);