On Thu, Dec 5, 2019 at 10:52 AM Todd Chester via perl6-users
<perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
Hi All,
In the following,
$ p6 'my %x= YesNo=>0xff, OkayCancel=>0x55; my $y="YesNo"; if %x<<$y>>
{say %x<<$y >>.base(16)}else{say "n"};'
FF
$ p6 'my %x= YesNo=>0xff, OkayCancel=>0x55; my $y="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 ยป 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
On 2019-12-05 01:56, Fernando Santagata wrote:
Try
say %x{$y}.base(16);
Fernando Santagata
Hi Fernando,
Much prettier! Thank you!
I would never remember to put he space in before the >>
-T
$ p6 'my %x= YesNo=>0xff, OkayCancel=>0x55; my $y="Help"; if %x{$y}
{say %x{$y}.base(16)}else{say "n"};'
n
$ p6 'my %x= YesNo=>0xff, OkayCancel=>0x55; my $y="YesNo"; if %x{$y}
{say %x{$y}.base(16)}else{say "n"};'
FF