On Mon, Feb 3, 2020 at 3:52 PM ToddAndMargo via perl6-users
<perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
Hi All,
Is ther a way to get
$ p6 'my uint8 $u = 84; printf "\$u = <%08s>\n", $u;'
$u = <00000084>
to print
$u = <0000_0084>
?
Many thanks,
-T
On 2020-02-03 14:13, yary wrote:
I think you need a more specific question...
p6 'my uint8 $u = 84; printf "\$u = <0000_%04s>\n", $u;'
-y
Hi Yary,
That is printing out in base 10.
$ p6 'my uint8 $u = 84; printf "\$u = <0000_%04s>\n", $u;'
$u = <0000_0084>
Trying that with base 2 gives me
$ p6 'my uint8 $u = 84; printf "\$u = <0000_%04b>\n", $u;'
$u = <0000_1010100>
"_" is in the wrong place. I want an under score every four bits.
:'(
-T