Think about Loose Coupling | |
PerlMonks |
Re: dbDescribe.plby rob_au (Abbot) |
on Jun 01, 2002 at 11:40 UTC ( [id://170906]=note: print w/replies, xml ) | Need Help?? |
Yes, there is a way to store formatting output, one which I only found out about recently while flicking through a copy of Perl in a Nutshell. The perlfunc:formline function, normally only used internally, allows for formats to be built and returned in the format output accumulator, $^A. Normally, the contents of this variable are outputted to the currently selected filehandle via the write command, but this variable, $^A, can be read and reset directly. For example:
Thus in this manner, through use of the formline function, both the output format and the subsequent formatted output can be retrieved and stored. For further information see perlfunc:formline and perlform. I had been intending to write an obfuscation based upon this trick, but ... oh well ... :-)
In Section
Cool Uses for Perl
|
|