in reply to Passing subroutines as arguments

You need to dereference the reference. Just as when $a contains an array reference, @$a will dereference it to give the array, so when $c contains a code reference, &$c will dereference it to call the code. To pass arguments, you just add a parenthesised list in the normal fashion:

sub sum { my($term, $a, $next, $b) = @_; return 0 if $a > $b; return &$term($a) + sum($term, &$next($a), $next, $b); }

You can also use the dereferencing arrow, in which case the parens are required:

sub sum { my($term, $a, $next, $b) = @_; return 0 if $a > $b; return $term->($a) + sum($term, $next->($a), $next, $b); }

Hugo