Re: I need hash syntax help

2018-09-15 Thread ToddAndMargo
On Fri, Sep 14, 2018 at 11:59 PM ToddAndMargo > wrote: Hi All, Why does `$y =%x<<$z>>` work in the following and `$y =%x<$z>` and `$y =%x<"$z"> do not work? $ p6 'my Str %x=("Jan"=>"01", "Feb"=>"02"); my Str $z="Jan"; my $y =

Re: I need hash syntax help

2018-09-15 Thread Brent Laabs
Because << >> is a double-quoted index (same as quote words «»), so it interpolates the variable. <> is a single-quoted string, so it doesn't interpolate. But what you really want here is %x{$z}, so you don't bother with string interpolation at all, and pass the String variable directly. On Fri,

I need hash syntax help

2018-09-15 Thread ToddAndMargo
Hi All, Why does `$y =%x<<$z>>` work in the following and `$y =%x<$z>` and `$y =%x<"$z"> do not work? $ p6 'my Str %x=("Jan"=>"01", "Feb"=>"02"); my Str $z="Jan"; my $y =%x<<$z>>; say "$y";' 01 Why did I get it right? Many thanks, -T