in reply to Undefined value as a symbol reference

You're trying to print to the filehandle $client, but it's not defined in writeClient, is it? or is that 'my' not bound by any codeblock?

Easy way out - Add a line before the 'print':

warn "client not defined!" and return unless defined $client;

-- zigdon