After reading this answer I looked through my code and found some places where I use elems with arrays.
I could remove all elems without affecting the code:
my @a = 1, 2, 3, 4, 5;
my $b = [ 1, 2, 3, 4 ];
my $i = 2;
say $i + @a.elems;
say $i + @a;
say "===============";
say @a.elems;
say 0 + @a;
say "===============";
say $b.elems / 2;
say $b / 2;
say "===============";
while state $c++ > $b.elems {
say $c;
}
while state $d++ > $b {
say $d;
}
That led me to wonder if there are situations where arrays have to be called with the elems function to make the code work.