in reply to how to assign hash element value to scalar?

The update is good, but doesn't help :). Can you post the two variants along with just enough data to populate $xml_content->content and show the problem? Hint: use a __DATA__ section to provide the $xml_content->content content, or simple replace $xml_content->content with $str initialised to your sample XML (using a heredoc perhaps?).

By the way,

$response->{channel}->{result}->{resultid}

can be written

$response->{channel}{result}{resultid}

and you can interpolate directly into the string rather than using concatenation by

print "resultid: $resultid";

DWIM is Perl's answer to Gödel