How can I set up a footer format to be used with write()?

There's no built-in way to do this, but the perlform manpage has a couple of techniques to make it possible for the intrepid hacker.