Next Tricks of the Wizards 206

reduce

        sub reduce (&$@) {
          my $code = shift;
          local $a = shift;
          for (@_) {
            local $b = $_;
            $a = &$code;
          }
          $a;
        }


Next Copyright © 2003 M. J. Dominus