in reply to caching formats
Thank you all for your responses.
As you can see from my original question, keeping format names in a hash as proposed by sundialsvc4 was the solution I was trying to avoid, hopeful that there is more efficient way through direct access to format namespace. Alas, there seems to be none, so storing names in the hash seems to be the only good way to reuse formats in my context.
I did look at using formline() as illustrated by Anonymous. It allows to avoid ugly eval, but it guarantees that format will be created every time swrite is invoked. Running swrite seems to be pretty much the same thing as running format, except there's no format name associated with it. It is definitely a strong alternative to eval approach when reusing formats is unimportant (e.g. when formats are different for each line).
Thanks again everyone!