http://qs321.pair.com?node_id=147387


in reply to Reading an incoming Data Stream..

Better would be one of the two following snippets:
while (defined ($buf = <$new_sock>)) { if ($buf =~ /"END"/) { } } ---- while (defined ($buf = <$new_sock>)) { chomp $buf; if ($buf eq '"END"') { } }
The first does a regex, avoiding the newline issue. The second removes the trailing newlines, then does a string comparison.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.