http://qs1969.pair.com?node_id=323420


in reply to Product of a list of numbers?

Your way is fine, but if you need more speed, look at PDL,

sub product { pdl( shift )->prodover; }
In the interest of speed, you'd probably want to work with piddles from the start, rather than converting like that.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Product of a list of numbers?
by etj (Deacon) on Jun 26, 2022 at 00:26 UTC
    Now the most idiomatic approach would be:
    PDL->topdl(shift)->prodover
    as topdl will not duplicate the data if it is already a pdl/ndarray.