I would like to multiply all the values of a hash together without having to call the specific elements. E.g. I DON’T want to do $hash{'kv1'} * $hash{'kv2'} * $hash{'kv3'} because I won’t know the number of elements in the hash to do this.
I’m guessing there is a simple and efficient function to do this, maybe using each or something, but I can’t find any examples to follow. Any ideas?
Start at 1 (since 1 multiplied by anything is what you multiple it by), then loop over the values of the hash and multiple the current total value by the value from the hash.