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

Hex string to buf question

Thread Next
From:
ToddAndMargo via perl6-users
Date:
June 19, 2022 07:33
Subject:
Hex string to buf question
Message ID:
945892c3-98ed-307a-e2fc-27f5ca4b1588@zoho.com
Hi All,

I have a string:

 > my Str $x = "1BB67AE85A";
1BB67AE85A

which has the hexadecimal values I want to
add to a buffer:

 > my buf8 $y = buf8.new($x.base(16));
No such method 'base' for invocant of type 'Str'.  Did you mean any of
these: 'Bag', 'Date', 'Hash', 'are', 'asec', 'hash', 'take'?
   in block <unit> at <unknown file> line 1

In other words, I want to set $y to
    0x1B 0xB6 0x7A 0xE8 0x5A

How do I do this?

Many thanks,
-T


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I had a dime every time I didn't know
what was going on, I'd be like, "Why is
everyone giving me all these dimes?"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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