Use the IO::Socket module; recent versions (since version 1.18) make sockets hot by default.