else { # It's an established connection print "established s $s listener $listener\n"; print $listener "Why don't you call me anymore?\n"; my $buf = <$s>; # Try to read a line # Was there anyone on the other end? if( defined $buf ) { # If they said goodbye, close the socket. If not, # echo what they said to us. if ($buf =~ /goodbye/i) { print $s "See you later!\n"; $readable->remove($s); $s->close; } else { print $s "You said: $buf\n"; }