|Problems? Is your data what you think it is?|
Writing formatted text to a string?by loris (Hermit)
|on May 16, 2011 at 12:12 UTC||Need Help??|
loris has asked for the
wisdom of the Perl Monks concerning the following question:
OK, after having asked about Placement of $~ or $FORMAT_NAME I've learnt somethingabout select(), but also that I was asking the wrong question.
I have a program that a naughty user can run and which uses format to produce a list of his or her acts of naughtiness on the console. Strangely, naughty users don't seem to run this program themselves very often. So I would like to run it myself and, if I feel that the user has been sufficiently naughty, send him or her the output of the program in an email.
For this I would like to able to print the formatted data either to the console or to a string. I could then pass the string as a message body to some thing like MIME::Lite. I can do the former, but for the latter the best I can come up with would be to write to a file and then read the contents of the file to a string.
Is there a less clunky alternative?