I've tried it, but it does not work.
By the way, on old installations it works with recv().
I've read that recv() shrinks to a smaller size if the last chunk of bytes is shorter than the specivfied size (4096 in this case), while sysread tries to read the specified size.
I've tested your implementation and - as with the original code - I can see with tcpdump the query results coming back as network traffic but I get nothing in Perl.