in reply to perl hangs on write syscall

How big is huge?

Have you tried using open to read the output piped from your command and process the data a line at a time?

open (my $in,'-|','ssh ...'); while (<$in>) { # do stuff }