Perl: Removing NULL characters (0x00)
David Smith
DavidSmith at byu.net
Sat Mar 5 13:39:59 MST 2005
<quote who="Alan Young">
> On Fri, 04 Mar 2005 17:36:50 -0700, Peter Bowen <peter at bowenfamily.org>
> 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. I'd automatically look for more than was there. Plus,
> he didn't say he wanted to get rid of *all* nulls, just at the end of
> the string. You're example would strip the nulls.
Just to conclude this thread, I can report that chop worked fine for
removing the trailing NULL. Howver, in the end, I configured the server to
not append 0x00 to strings sent to the client.
--Dave
More information about the PLUG
mailing list