in reply to Re^4: system function not handling string properly
in thread system function not handling string properly

Normal Data::Dumper returns
$VAR1 = 'www.youtube.com/watch?v=mark';

but after setting

$Data::Dumper::Useqq = 1;

I get

$VAR1 = "w\0w\0w\0.\0y\0o\0u\0t\0u\0b\0e\0.\0c\0o\0m\0/\0w\0a\0t\0c\0h +\0?\0v\0=\0m\0a\0r\0k\0";

To get the correct output, I have to

use Encode; $link = decode('utf-16-le', $link);
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^6: system function not handling string properly
by McA (Priest) on Sep 06, 2013 at 21:54 UTC

    Thank you. That is really interesting. Good finding!

    I'm really curious why Data::Dumper doesn't show the 0-bytes?

    Best regards
    McA

      I'm really curious why Data::Dumper doesn't show the 0-bytes?

      It does :) its your browser/editor/shell that doesn't actually display them (non-printable), and in some cases doesn't actually copy/paste them

      Data::Dump does useqq-type-deal by default, and in a step of brilliance exports a dd kinda like this one

      sub dd { use Data::Dumper; print Data::Dumper->new([@_])->Sortkeys(1) ->Indent(1)->Useqq(1)->Dump . "\n"; }

      I'm really tired of typing print Dumper();... say Dumper()... so nowadays I have -MData::Dump=dd,pp in my PERL5OPT

      Thanks alot! I guess I need to brush up on my knowledge of encoding (and Data::Dumper for that matter).