sub compose { my ($f, $f2, @rest) = @_; return $f unless defined $f2; return &compose(sub { $f2->($f->(@_)) }, @rest); } *bold_italic_and_underlined_paragraph = compose( &curry(\&wrap_with_html, 'u'), &curry(\&wrap_with_html, 'b'), &curry(\&wrap_with_html, 'i'), &curry(\&wrap_with_html, 'p') ); print bold_italic_and_underlined_paragraph("test");