develooper Front page | perl.perl6.users | Postings from June 2022

append to Bug question

Thread Next
From:
ToddAndMargo via perl6-users
Date:
June 19, 2022 04:13
Subject:
append to Bug question
Message ID:
fe2021dd-fc7d-c987-1217-c6c92449fa46@zoho.com
Hi All,

What am I doing wrong here:

 > my Buf $y = Buf.new( 0xFA xx 10);
Buf:0x<FA FA FA FA FA FA FA FA FA FA>

 > $y ~= 0xBB.encode.Buf;
Buf:0x<FA FA FA FA FA FA FA FA FA FA 31 38 37>

I got three entries (31 38 37) instead of one (0xBB)


Some more goofing around:

 > $y ~= 0xBB;
Stringification of a Buf is not done with 'Str'.  The 'decode' method
should be used to convert a Buf to a Str.
   in block <unit> at <unknown file> line 1

[10] > $y += 0xBB;
Type check failed in assignment to $y; expected Buf but got Int (201)
   in block <unit> at <unknown file> line 1



Many thanks,
-T



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we ask for advice, we are usually looking for an accomplice.
    --  Charles Varlet de La Grange
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thread Next


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