in reply to Socket Server Speed

as amphiplex pointed out, sleeping is your main problem. you could also tidy up that long if(substr( statment up a lot by putting all the stuff you want to compare against in a hash.
unless(defined($hash_of_strings{substr($_,0,4)})) { # do stuff }
another point, that has nothing to do with speed, but would make your code a little more readable. the only part of that you can't indent is the part between the EOF's. the rest of the if statement can be indented.