Re: Perl: Removing NULL characters (0x00)

2005-03-05 Thread David Smith
> On Fri, 04 Mar 2005 17:36:50 -0700, Peter Bowen <[EMAIL PROTECTED]> > wrote: >> I suggested it because this is what pack/unpack was designed to do... >> extract data from streams. In this case a null terminated string. > > Seems to me a trivial usage of pack, and not as clear to follow up > pr

Re: Perl: Removing NULL characters (0x00)

2005-03-05 Thread Alan Young
On Fri, 04 Mar 2005 17:36:50 -0700, Peter Bowen <[EMAIL PROTECTED]> wrote: > I suggested it because this is what pack/unpack was designed to do... > extract data from streams. In this case a null terminated string. Seems to me a trivial usage of pack, and not as clear to follow up programmers.

Re: Perl: Removing NULL characters (0x00)

2005-03-04 Thread Peter Bowen
I suggested it because this is what pack/unpack was designed to do... extract data from streams. In this case a null terminated string. 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 di

Re: Perl: Removing NULL characters (0x00)

2005-03-04 Thread Alan Young
> 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? -- Al

Re: Perl: Removing NULL characters (0x00)

2005-03-04 Thread Peter Bowen
David, 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. -Peter David Smith wrote: I wrote a perl TCP/IP client program that talks to a se

Re: Perl: Removing NULL characters (0x00)

2005-02-25 Thread Alan Young
On Fri, 25 Feb 2005 11:22:07 -0700 (MST), David Smith <[EMAIL PROTECTED]> wrote: > I wrote a perl TCP/IP client program that talks to a server. The server > sends me ASCII over the scoket, but it appends a NULL byte to every string > (0x00), which I discovered with file redirection and a hex editor

Re: Perl: Removing NULL characters (0x00)

2005-02-25 Thread Corey Edwards
On Fri, 2005-02-25 at 11:22 -0700, David Smith wrote: > I wrote a perl TCP/IP client program that talks to a server. The server > sends me ASCII over the scoket, but it appends a NULL byte to every string > (0x00), which I discovered with file redirection and a hex editor (it was > invisible in the

Re: Perl: Removing NULL characters (0x00)

2005-02-25 Thread Doran Barton
Not long ago, David Smith proclaimed... > I wrote a perl TCP/IP client program that talks to a server. The server > sends me ASCII over the scoket, but it appends a NULL byte to every string > (0x00), which I discovered with file redirection and a hex editor (it was > invisible in the shell output)

Perl: Removing NULL characters (0x00)

2005-02-25 Thread David Smith
I wrote a perl TCP/IP client program that talks to a server. The server sends me ASCII over the scoket, but it appends a NULL byte to every string (0x00), which I discovered with file redirection and a hex editor (it was invisible in the shell output). How can I prune this byte off of the string in