A few things off the top of my rather empty head ...
- use eq, not == for the string comparrisons in &handle()
- you may want to use elsif instead of two seperate if statements.
- Make sure you are using a CRLF at the end of each line you print (some clients will require that)
- if the above does not help, you may want to look into using non-buffered IO
i had a memory leak once, and it ruined my favorite shirt.