Perl: Removing NULL characters (0x00)

David Smith DavidSmith at
Fri Feb 25 11:22:07 MST 2005

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 Perl? I tried chomp, but it appears to only remove \r and \n. I
also tried s/\s+$// but \s doesn't appear to match the 0x00 character.

Thanks in advance.


More information about the PLUG mailing list