extasia at extasia.org
Tue May 13 13:34:12 PDT 2008
sending this in case you've made the same mistaken assumption i made...
by default, Data::Dumper will print the empty string for non-printable
characters. you have to set $Data::Dumper::Useqq to true to have it
render non-printable characters. when it does this, it prints them as
escaped octal numbers. note that under certain circumstances it will
print ascii nul as a single escaped zero and under others, as an
escaped string of three zeroes.
$ perl -MData::Dumper -de 1
Loading DB routines from perl5db.pl version 1.27
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
DB<1> x $Data::Dumper::Useqq
DB<2> print Dumper chr 0
$VAR1 = '';
DB<3> $Data::Dumper::Useqq = 1
print Dumper chr 0
$VAR1 = "\0";
DB<5> $x = "\x00" . '0'
DB<6> print Dumper $x
$VAR1 = "\0000";
it mildly disturbs me that if you don't know about Useqq you'll see
values printed without any non-printable characters they might
contain. but then i didn't write Data::Dumper and am not sure what i
might have done differently.
anyway, don't assume what i assumed. :-)
Live in a world of your own, but always welcome visitors.
More information about the SanFrancisco-pm