Can any of you fine folks out there think of a way to send the output of a "format" section to a variable, rather than out to a filehandle. I want to re-use it in a Tk Entry box you see.
Well, in a way yes it is, but I was hopeing to be able to use all of Format's useful setup arguments. I assumed it would be pretty simple to use a variable instead of a Filehandle, or a filehandle pointing at a variable, I didn't know how to do this, but thought it would be a pretty simple problem to solve.
I suppose I could use sprintf, but I'm sure format would be just as simple.
I'm just after glancing at "Programming Perl" (Riley), and it says that its just another symbol in the symbol table, that defaults to STDOUT, but you could open a pipe to another handle and work it that way. and i quote "Not very convenient, but doable"
I'm just after looking at it for the first time.
What you're talking about seems to have been on the TO-DO-LIST for Perl 5 (subversion unknown), but it may have been addressed in later versions
I think the long and very memory, and processor in-efficient way of doing it, would be to use format out to a file, then read in the file again, It's a "loopy" way of doing it, but it's probably what I will use.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.