in reply to Re: "Dynamically" Accessing a HoH
in thread "Dynamically" Accessing a HoH

Given that the input data was originally XML parsed with XML::Simple, if you're going to use a format like depTar/name for the user input, you can use XML::XPath to extract the results:
use XML::XPath; use XML::XPath::XMLParser; my $usr_string = "depTar/name"; my $xml = "<depTar><name>c_p20</name><loc>srvr1</loc></depTar>"; my $xp = XML::XPath->new(xml => $xml); my $nodeset = $xp->find($usr_string); foreach my $node ($nodeset->get_nodelist) { print $node->string_value(), "\n"; }