in reply to using perl 6 book trying first example

As snoopy pointed out, additional whitespace or newlines can cause that problem. In that case $result ends up as Any, and you get that error (which includes less information than it should, due to a known bug in Rakudo).

Two weeks ago I've added a note about the lack of robustness, and now expanded it a bit.

We've decided not to use regexes for splitting or data extraction that early in the book, because they will be explained only two chapters later.

Perl 6 - links to (nearly) everything that is Perl 6.