if ($fh == $lsn) { # this does not do what you think it does #### $inbuffer{$fh} .= $buf; # Hash keys are stored as STRINGS. ... foreach $client (keys %ready) { # So, when you are finally here # $client is just a STRING # It is no longer a reference handle($client); }