Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Reading an incoming Data Stream..

by dragonchild (Archbishop)
on Feb 25, 2002 at 21:08 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found