my @keys = split '/', $usr_string; my $ref = $xml; $ref = $ref->{$_} for @keys; print $ref;