@num = (2, 4, 5, 7); use List::Util "reduce"; $lsub = reduce { $a - $b } @num; $asum = reduce { $b - $a } reverse @num; $coeff = do { my @y = @num; while (1 < @y) { $y[$_] -= $y[$_ + 1] for 0 .. @y - 2; splice @y, -1; } $y[0] }; print "lisp difference: $lsub\nalternating sum: $asum\nhighest coeff: $coeff\n"; #### lisp difference: -14 alternating sum: -4 highest coeff: -2