my $test=XMLin('path\file.xml', KeepRoot=>1, KeyAttr=>"element2", ForceArray=>0); if($test->{root}->{element2}->{attribute} eq "positive") {print "Found It";} else {print "No Luck";}