String::BufferStack provides a framework for storing nested buffers. By default, all of the buffers flow directly to the output method, but individual levels of the stack can apply filters, or store their output in a scalar reference. WWW: http://search.cpan.org/dist/String-BufferStack/