I'm using your code snippet to talk to a NETCONF Agent. The problem I'm having is that the response is only showing the hello response, nothing else. For my second query I have sent a get-config and can see that processed on the Agent and a log entry confirming that it sent the response.
Would it be possible for you to append your mainline is case something has got missed?
Below is the merged content from the thread above that I'm using.
## PRINT THE RESULTS
last if $_ =~ m/\/nf:rpc-reply/;