use Fcntl; ... my $socket = new IO::Socket::INET(@_) or die; $socket->fcntl(F_SETFD, 0) or die; # clear CLOEXEC ... # $socket->fcntl(F_SETFD, FD_CLOEXEC); # set CLOEXEC