I want to test for a key being defined in one hash, and if it is, then it should be a hash, and I need the value of that second key.

So I was testing my syntax with raku and got the following:

raku
Welcome to ๐‘๐š๐ค๐ฎ๐๐จโ„ข v2020.12.
Implementing the ๐‘๐š๐ค๐ฎโ„ข programming language v6.d.
Built on MoarVM version 2020.12.

To exit type 'exit' or '^D'
> my %h = <one two three> Z=> 1..*
{one => 1, three => 3, two => 2}
> %h<five> = %( this-keyย  => 'something' )
{this-key => something}
> my $x
(Any)
> with %h<five> { do with .<this-key> { $x = $_ } }
something
> with %h<five> { do with .<this-key> { $x = $_ } }
===SORRY!===
Word 'with' interpreted as a listop; please use 'do with' to introduce the statement control word
at line 4
------> $ = withโ %h<five> { do with .<this-key> { $x = $
Unexpected block in infix position (two terms in a row)
at line 4
------> $ = with %h<five>โ { do with .<this-key> { $x = $_ } };

Note the lines begining with 'with'. Exactly the same line, executed twice, produces two significantly different answers.

I think this shouldn't happen.

Reply via email to