Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Parsing data from a data feed

by bikeNomad (Priest)
on Jul 19, 2001 at 00:09 UTC ( [id://97871]=note: print w/replies, xml ) Need Help??


in reply to Parsing data from a data feed

You don't want to compare the characters with hex(0x00), because this is just a 0. Comparing arbitrary strings with 0 won't work, since non-numeric ones will evaluate to 0. You want to say something like  $response == "\x00"

Beyond that little problem, you're not checking the status in the recv call.

You might try instead letting the getline call work and get your data a record at a time, by setting the input record separator $/ to NUL:

local $/ = "\x00"; $response = $socket->getline; if ($socket->eof) { ... }

update: you may have been thinking about chr(0) which returns "\x00".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found