Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Reading an incoming Data Stream..

by dragonchild (Archbishop)
on Feb 25, 2002 at 21:08 UTC ( #147387=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://147387]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-05-26 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (93 votes). Check out past polls.

    Notices?