I've seen code where this is done with substrs to try to chop off the junk at the beginning and lop off the terminator at the end - because the programmer didn't realize that the "junk" was a couple of ints to describe the type of message, and the length of the text, and the null was the string terminator. The worst was when I wrote the driver for the XM PCR... the existing stuff was trying to guess wheree the data was and how many messages to expect. By unpacking and handling the data, we converted it to an event driven model that can Tivo radio in perl... it was pretty cool - it still is :)
-Peter
Alan Young wrote:
What you're really looking for is pack/unpack try this...
unpack("A*",$value) - it's pretty common for c++ stuff to marshall a
struct together and send it to you, and perl just sees a really long string.
Just to get rid of nulls? or do you have another reason for suggesting pack?
.===================================. | This has been a P.L.U.G. mailing. | | Don't Fear the Penguin. | | IRC: #utah at irc.freenode.net | `==================================='