http://www.perlmonks.org?node_id=206481


in reply to A format to "print" to variable?

Check out Open Has a New Trick ... Zaxo demonstrates a nifty way of associating a filehandle with a scalar variable.

Whether this is the best way to go about the problem I have no idea, but it's a neat trick.

Matt

P.S. Upon rereading your request, I might be guilty of an overly elaborate interpretation. You might want the sprintf() function if you merely want to format a string...I was thinking you wanted to use formats.