in reply to FORMATS, filehandle and variables

Perhaps you could just skip out the second step and implement something like swrite() as demonstrated in perlform e.g
sub swrite { local $^A; formline( $_[0], @_[ 1 .. $#_ ] ); return $^A; } my $output = swrite(<<FORM, 1 .. 5 ); @<<<@|||@>>>@|||@<<< FORM print "format: $output", __output__ format: 1 2 3 4 5
HTH

_________
broquaint