in reply to Print specific attributes "not their values" of an XML file using Perl

If you're up to using a different library, then:
use warnings; use strict; use XML::Rules; my $xml = <<XML; <root> <Validation byCluster="true" byOtherPop="false" byHapMap="true" by1000 +G="true"/> </root> XML my @rules = ( Validation => sub { my $d = $_[1]; my @v = grep { $d->{$_} eq 'true' } keys %$d; print join(",", @v), "\n"; }, _default => undef, ); my $xr = XML::Rules->new( rules => \@rules ); $xr->parse($xml);
  • Comment on Re: Print specific attributes "not their values" of an XML file using Perl
  • Download Code