while (1) { print "yo\n"; while ( my @handles = $self->{daemon}->can_read(1) ) { foreach ( @handles ) { if ($_ == $self->{listener}) { my $new_sock = $self->{listener}->accept or die "accept: $!"; $self->{daemon}->add( $new_sock); } else { my @rawmsg = $_->getlines; if ($rowmsg[0]){ # Or what ever the index of the message is print @rawmsg; } else { $self->{daemon}->remove($_); $_->close; } } } }