Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: system function not handling string properly

by McA (Priest)
on Sep 06, 2013 at 21:45 UTC ( #1052778=note: print w/ replies, xml ) Need Help??


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

In this case I would be really interested in

print Dumper($link);

;)


Comment on Re^4: system function not handling string properly
Download Code
Replies are listed 'Best First'.
Re^5: system function not handling string properly
by choroba (Canon) on Sep 06, 2013 at 21:50 UTC
    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);
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      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).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-08-01 01:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls