while($buf=~/(.*\n)/g) { print DEBUG "doing <$1>\n"; ${$Con{$fh}}{getline}($fh,$1); last unless $Con{$fh}; # it's possible that the connection can be deleted while there's still something in the buffer } if($Con{$fh}) { ($this->{_})=$buf=~/([^\n\r]*)$/s; if(length($this->{_}) > 10000) { ${$Con{$fh}}{getline}($fh,$this->{_}); ($this->{_})=''; } }