block subroutines

[% hello = block(name) %] Hello [% name or 'World' %]! [% end %] [% hello('World') %] [% hello('Badger') %] --EOF--
look inside...
Thus Spake Andy:

You can also use block like sub to create anonymous lazy blocks that you can then assign to a variable in an expression. Here block behaves very much like sub with one important difference. block returns all the output generated within it. sub returns only the last expression evaluated (like Perl). The simple rule is that sub is for computation, block is for content generation.