On Sat, Oct 01, 2005 at 02:22:01PM -0600, Luke Palmer wrote: > And the more general form was: > > $sum = reduce { $^a + $^b } @items; > > Yes, it is called reduce, because "foldl" is a miserable name.
So, the target of running a loop with both the current and previous elements accessible could be written as either: reduce :identity undef { code using $^prev and $^cur ... ; $^cur } @items; or: reduce :identity @items[0] { code using $^prev and $^cur ... ; $^cur } @items[1...]; --