POSIX::dup2(fileno($sock), 0) or die "Cannot dup sock to STDIN: $!"; POSIX::dup2(fileno($sock), 1) or die "Cannot dup sock to STDOUT: $!";