There is no length

len, .length and length do not exist in Raku. A string has .chars, and a list has .elems.

Every language has a way to ask “how long is it?”, and each one spells it differently. Raku spells it in two ways, because it is two questions.

In Python

print(len("Riga"))
print(len(["Riga", "Leiden", "Turin"]))
4
3

In JavaScript

console.log("Riga".length);
console.log(["Riga", "Leiden", "Turin"].length);
4
3

In Perl

my @cities = ("Riga", "Leiden", "Turin");
print length("Riga"), "\n";
print scalar(@cities), "\n";
4
3

In Raku

say "Riga".length;
No such method 'length'
my @cities = 'Riga', 'Leiden', 'Turin';
say @cities.length;
No such method 'length' for invocant of type 'Array'

There is no function called len or length either. Raku stops and tells you that it does not know that routine.

Why

“How long” can mean different things. For a string, it can mean the number of characters or the number of bytes, and those are not the same once a word has letters outside English:

say "Rīga".chars;
say "Rīga".encode.bytes;
4
5

The letter ī takes two bytes. Raku does not guess which length you mean: .chars counts characters, and .elems counts the elements of a list.

Say it in Raku

my @cities = 'Riga', 'Leiden', 'Turin';
say "Riga".chars;
say @cities.elems;
4
3

Be careful not to swap them. Each one works on the other kind of value too, and gives an answer you did not ask for:

my @cities = 'Riga', 'Leiden', 'Turin';
say @cities.chars;
say "Riga".elems;
17
1

.chars on an array first turns it into the string Riga Leiden Turin, which has 17 characters. .elems on a string treats it as a list with one element: the string itself.