in reply to Remove nulls, or other Chars
use strict; use warnings; use Data::Dumper; $Data::Dumper::Useqq = 1; my @a = ("a\000b\000c", "foo\000bar"); print Dumper \@a; my @cleaned = map {tr/\000//d; $_ } @a; print Dumper \@cleaned;
Please note that a common cause for null bytes is the use of UTF-16; if that's the case, don't remove the null bytes, but decode the strings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Remove nulls, or other Chars
by Saved (Beadle) on Apr 01, 2011 at 14:26 UTC |