__END__ sub make_func { my $tag = shift; return sub { my @args = @_; return ml( \&XML_elem, $tag, @args ); } } print "\n == code fragment 4 ============================================= \n"; $root = make_func( 'root' ); $branch = make_func( 'branch' ); $sub_branch = make_func( 'sub_branch' ); print join "\n", $root->( { ID => 0 }, $branch->( $sub_branch->( { foo => 2 }, 'some contents & entities "<>"' ), 'other contents', ), 'root stuff', )->(); ; __END__