in reply to Non existent Hash and error"not a hash refernece at perl line"

Because XML will produce a nested structure of arrays and hashes at arbitrary depth, you'll anyway need to test what is found recursively. e.g.:
# load XML into $tree here, then ... traverse ($tree); sub traverse { my $tree = shift; if (ref($tree) eq 'ARRAY') { traverse($_) for (@$tree); } elsif (ref($tree) eq 'HASH' ) { while (my ($k, $v) = each %$tree) { # process key $k traverse($v); } } elsif (!ref($tree)) { # process $tree as a scalar here } else { die "unexpected type of reference: " . ref($tree); } }

One world, one people

  • Comment on Re: Non existent Hash and error"not a hash refernece at perl line"
  • Download Code