In perdoc Socket, the page uses the global file descriptor for the socket. But if I create a socket in a routine called by child processes, is it better to use a lexical file descriptor using Socket?
like this:
use strict; use Socket; sub sendData { my $proto = getprotobyname('tcp'); my $socket; socket($socket, PF_INET, SOCK_STREAM, $proto); ... close($socket) }
instead:
sub sendData { my $proto = getprotobyname('tcp'); socket(SOCKET, PF_INET, SOCK_STREAM, $proto); ... close(SOCKET) }
Everything seems to be in order, but I donβt know if it is better or completely useless ...
thanks
user1334149
source share