hash and print question

Hi All,

In the following,


$ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"YesNo"; if  %x<<=
$y>>=20
{say %x<<$y >>.base(16)}else{say "n"};'
FF

$ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"Help"; if  %x<<$=
y>>=20
{say %x<< $y >>.base(16)}else{say "n"};'
n

I have to use a space after $y
    say %x<<$y >>.base(16)

or I get the finger wagged at me.

     Ambiguous use of >>; use =C2=BB instead to mean hyper, or
     insert whitespace before >> to mean a quote terminator
     (or use different delimiters?)

Is there a better way to write:
     say %x<<$y >>.base(16)

Many thanks,
-T
0
perl6
12/5/2019 9:49:13 AM
perl.perl6.users 1278 articles. 0 followers. Follow

3 Replies
19 Views

Similar Articles

[PageSpeed] 28

--000000000000b726b10598f1f1f5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Try

say %x{$y}.base(16);

On Thu, Dec 5, 2019 at 10:52 AM Todd Chester via perl6-users <
perl6-users@perl.org> wrote:

> Hi All,
>
> In the following,
>
>
> $ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"YesNo"; if  %x=
<<$y>>
> {say %x<<$y >>.base(16)}else{say "n"};'
> FF
>
> $ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"Help"; if  %x<=
<$y>>
> {say %x<< $y >>.base(16)}else{say "n"};'
> n
>
> I have to use a space after $y
>     say %x<<$y >>.base(16)
>
> or I get the finger wagged at me.
>
>      Ambiguous use of >>; use =C2=BB instead to mean hyper, or
>      insert whitespace before >> to mean a quote terminator
>      (or use different delimiters?)
>
> Is there a better way to write:
>      say %x<<$y >>.base(16)
>
> Many thanks,
> -T
>


--=20
Fernando Santagata

--000000000000b726b10598f1f1f5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"color:#000000">Try</=
div><div class=3D"gmail_default" style=3D"color:#000000"><br></div><div cla=
ss=3D"gmail_default" style=3D"color:#000000">say %x{$y}.base(16);<br></div>=
</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=
On Thu, Dec 5, 2019 at 10:52 AM Todd Chester via perl6-users &lt;<a href=3D=
"mailto:perl6-users@perl.org">perl6-users@perl.org</a>&gt; wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">Hi All,<br>
<br>
In the following,<br>
<br>
<br>
$ p6 &#39;my %x=3D YesNo=3D&gt;0xff, OkayCancel=3D&gt;0x55; my $y=3D&quot;Y=
esNo&quot;; if=C2=A0 %x&lt;&lt;$y&gt;&gt; <br>
{say %x&lt;&lt;$y &gt;&gt;.base(16)}else{say &quot;n&quot;};&#39;<br>
FF<br>
<br>
$ p6 &#39;my %x=3D YesNo=3D&gt;0xff, OkayCancel=3D&gt;0x55; my $y=3D&quot;H=
elp&quot;; if=C2=A0 %x&lt;&lt;$y&gt;&gt; <br>
{say %x&lt;&lt; $y &gt;&gt;.base(16)}else{say &quot;n&quot;};&#39;<br>
n<br>
<br>
I have to use a space after $y<br>
=C2=A0 =C2=A0 say %x&lt;&lt;$y &gt;&gt;.base(16)<br>
<br>
or I get the finger wagged at me.<br>
<br>
=C2=A0 =C2=A0 =C2=A0Ambiguous use of &gt;&gt;; use =C2=BB instead to mean h=
yper, or<br>
=C2=A0 =C2=A0 =C2=A0insert whitespace before &gt;&gt; to mean a quote termi=
nator<br>
=C2=A0 =C2=A0 =C2=A0(or use different delimiters?)<br>
<br>
Is there a better way to write:<br>
=C2=A0 =C2=A0 =C2=A0say %x&lt;&lt;$y &gt;&gt;.base(16)<br>
<br>
Many thanks,<br>
-T<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">Fernando Santagata</div>

--000000000000b726b10598f1f1f5--
0
nando
12/5/2019 9:56:21 AM
>> On Thu, Dec 5, 2019 at 10:52 AM Todd Chester via perl6-users=20
>> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>>=20
>>     Hi All,
>>=20
>>     In the following,
>>=20
>>=20
>>     $ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"YesNo"; i=
f  %x<<$y>>
>>     {say %x<<$y >>.base(16)}else{say "n"};'
>>     FF
>>=20
>>     $ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"Help"; if=
  %x<<$y>>
>>     {say %x<< $y >>.base(16)}else{say "n"};'
>>     n
>>=20
>>     I have to use a space after $y
>>          say %x<<$y >>.base(16)
>>=20
>>     or I get the finger wagged at me.
>>=20
>>           Ambiguous use of >>; use =C2=BB instead to mean hyper, or
>>           insert whitespace before >> to mean a quote terminator
>>           (or use different delimiters?)
>>=20
>>     Is there a better way to write:
>>           say %x<<$y >>.base(16)
>>=20
>>     Many thanks,
>>     -T



On 2019-12-05 01:56, Fernando Santagata wrote:
> Try
>=20
> say %x{$y}.base(16);
>=20
> Fernando Santagata

Hi Fernando,

Much prettier!  Thank you!

I would never remember to put he space in before the >>

-T

$ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"Help"; if  %x{$y=
}=20
{say %x{$y}.base(16)}else{say "n"};'
n

$ p6 'my %x=3D YesNo=3D>0xff, OkayCancel=3D>0x55; my $y=3D"YesNo"; if  %x{$=
y}=20
{say %x{$y}.base(16)}else{say "n"};'
FF
0
perl6
12/5/2019 9:59:49 AM

On 2019-12-05 01:59, Todd Chester via perl6-users wrote:
> put he space

or the "t" before "the".  Chuckle.
0
perl6
12/5/2019 10:12:02 AM
Reply: