product#
Multiply every value in the list and return the numerical product.
תקציר#
my $p = product @values;
my $p = product 1..10; # 3628800
מה מוחזר#
A single number. Integer overflow is promoted to floating point transparently, so the result is an integer as long as the exact product fits in an IV. An empty list yields 1 (the multiplicative identity).
דוגמאות#
my $n = product 3, 9, 12; # 324
my $n = product(); # 1
my $n = product map { $_->weight } @items;
הבדלים מן ה-upstream#
Fully compatible with upstream.
ראו גם#
sum- additive counterpart.sum0- additive counterpart that mirrorsproduct’s identity-element behaviour on empty input.reduce- the generic reduction whenproductis not specific enough.