in reply to reading from sockets

Try this:

{ local $/ = "abcd"; $data = <SOCKET>; }
This should read data from the socket until it sees "abcd" and then it will stop.