I have an array:
my @e = <60.922 20.946 8.721 7.292 4.306 2.821 2.765 2.752 2.741 2.725>
I would like to divide every element in the array by the minimum, however
@e /= @e.min
produced a single element, which isn’t correct.
I’ve read https://docs.raku.org/type/Array but I don’t understand the basic elements of Raku for this.
How can I divide every item in the array by the same number?
>Solution :
my @a = 2, 3, 5, 7, 10;
my $div = @a.min;
$_ /= $div for @a;
say @a; # [1 1.5 2.5 3.5 5]
When you iterate over an array, you get mutable elements.