in reply to format/write to variable

The easiest way to do this is to write your own interface to the formline function making use of the Accumulator ($^A). Look at the perlform man page for more details. As mentioned above, the man page describes a function swrite(). For reference this is it:
sub swrite { croak "usage: swrite PICTURE ARGS" unless @_; my $format = shift; $^A = ""; formline($format,@_); return $^A; }

To actually make use of this is a little harder because you will have to call this function repeatedly as your format changes. This will become clearer once you play with it.

HTH
Simon