use threads; use threads::shared; use IO::Socket; my $server = new IO::Socket::INET(LocalHost => 'localhost', LocalPort => 3333, Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1); my %CLIENTS : shared = (); my $clientID : shared = 0; while( my $newClient = $server->accept ) { $clientID++; $CLIENTS{$clientID} = &share($newClient); #<--Error print "hCLIENT: " . $CLIENTS{$clientID} . "\n" }