I'm writing something showing how you'd write the same
simple program in various different languages.  I'd
appreciate it if some Ruby expert could tell me the
canonical way to write in Ruby what you would express
in Scheme as

(define (foo x) (lambda (y) (set! x (+ x y))))

or Perl 5 as

sub foo {
  my ($n) = @_;
  return sub {return $n += shift}}

If you want to reply to me directly please use 
pgremove / paulgraham.com, removing the remove.  

Thanks!  --pg