Str is no doubt a string. In Perl 6, there are methods to manipulate strings. Again, you call them as methods on objects.
my $str = "My string"; say $str.lc; # my string say $str.uc; # MY STRING say $str.index('t'); # 4
Let us now get the length of a string. The naΓ―ve attempt to write $str.length produces an error message. However, a hint is also provided:
No such method 'length' for invocant of type 'Str' Did you mean 'elems', 'chars', 'graphs' or 'codes'?
Thus, we have a simple and a mono-semantic method to get the length of a Unicode string.
say "ΟΞ΅ΟΞ» 6".chars; # 6
Getting used to the new way of working with strings as objects may take some time. For example, this how you can call the printf as a method on a string:
"Today is %02i %s %i\n".printf($day, $month, $year);