|Perl: the Markov chain saw|
open STDOUT to a subroutine reference?by jandrew (Chaplain)
|on Nov 06, 2012 at 16:13 UTC||Need Help??|
jandrew has asked for the
wisdom of the Perl Monks concerning the following question:
Whenever possible I use a subset of a project that I am working on to learn some new element of perl. This winds up being a really great way to improve my perl-Foo but can on occaision lead to a massive time sink with no actual result.Currently I have hit an impasse on my latest 'I wonder if I can do that' and I would like some feedback if possible. I'm trying to open STDOUT to a subroutine reference and I'm intrigued by the fact that it doesn't die but it also doesn't behave the way I had hoped. I also wonder if it's significant that the variable is still a CODE ref even after I use it in the open statement.
results in the output
I would like to get
Any help or even don't go there's with an explanation would be helpful. I am aware of tee and pipe and although tie seemed intriguing I couldn't get it to tie \*STDOUT to a CODE ref at all.