develooper Front page | perl.perl5.porters | Postings from February 2007

Re: Future Perl development

From:
Dr.Ruud
Date:
February 6, 2007 00:40
Subject:
Re: Future Perl development
Message ID:
20070206084030.14339.qmail@lists.develooper.com
Juerd Waalboer schreef:
> Dr.Ruud:

>> perl -wle '
>>   $s = substr "\x{100}\xFF", 1;
>>   print length $s, ":", unpack "H*", $s;
>> '
>
> Note that normally, unpack "H*" on a unicode string (like your $s) is
> a violation of proper separation.
>
> Of course, it's warranted when you really want to demonstrate the
> internals like you have now. I'm just commenting for clarity.

Yes, thanks for that note, I should have included such a "warning"
myself.


> My preferred way to show the internals is Devel::Peek::Dump:
>
>     use Devel::Peek;
>
>     $s = substr "\x{100}\xFF", 1;
>     Dump $s;
>
> Output:
>
>     SV = PV(0x8149ae8) at 0x8149624
>       REFCNT = 1
>       FLAGS = (POK,pPOK,UTF8)
>       PV = 0x816a920 "\303\277"\0 [UTF8 "\x{ff}"]
>       CUR = 2
>       LEN = 4

Nice tool for my box too.

-- 
Affijn, Ruud

"Gewoon is een tijger."




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About