my $parser = XML::Rules->new( rules => [ 'computers,and,other,tags,you do not care about at all' => 'skip', '^user' => sub {return $_[1]->{teamid} eq $CONFIG{teamid} }, 'user' => 'as array', # only the tags containing the right attribute will be processed '_default' => 'as is', 'tags,with,no,attributes' => 'content', ] ); my $data = $parser->parse($the_xml);