sub compose { my $c = shift; foreach my $s (@_) { my $o = $c; $c = sub { $s->($o->(@_)) } } $c }