in reply to Reg socket
For starters, you never create a socket in the child?! use strict;!!
By the way,
$SIG{CHLD} = sub {wait ()}; [download]
is better written as
$SIG{CHLD} = 'IGNORE'; [download]