use strict; use XML::Rules; my $parser = XML::Rules->new( stripspaces => 7, rules => { _default => 'content', Copyright => 'no content', # ... Record => sub { return unless $_[1]->{Title} eq 'Something'; print "The stuff in the %{$_[1]} hash containing the attributes and subtag data.\n"; return; } } ) $parser->parse($file);