> On Jun 18, 2022, at 11:13 PM, ToddAndMargo via perl6-users 
> <perl6-us...@perl.org> wrote:
> 
> Hi All,
> 
> What am I doing wrong here:

From just looking at your code, I am not clear on what you are trying to do.

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

Yes, because:
        raku -e 'say 0xBB.encode;'
                utf8:0x<31 38 37>


> 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.
> [10] > $y += 0xBB;
> Type check failed in assignment to $y; expected Buf but got Int (201)

--snip--

If all you want is to append 0xBB to $y, either of these will work:
$y ~= Buf.new(0xBB);
$y.append(0xBB);

-- 
Hope this helps,
Bruce Gray (Util of PerlMonks)

Reply via email to