use strict; use XML::Rules; my $parser = XML::Rules->new( stripspaces => 7, rules => { _default => 'content', Book => sub { my ($tag,$attr) = @_; if (!$attr->{Title}) { return; }# no title, OK. ignore print "$attr->{Title} by $attr->{Author} was released $attr->{Released}\n"; return; }, }, ); $parser->parse(\*DATA); # or $parser->parsefile('path/to/the/file');