in reply to When would you use functional programming?
the prod_list function could be implemented much more simply in many functional languages using a 'foldl' or 'foldr' construct.
check out the CPAN module Functional. it provides a whole slew of useful functional constructs. including foldl:
use Functional; sub prod_list {foldl1(sub {$_[0]*$_[1]},[@_])} print prod_list(3,2,1,10);
|
|---|