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


in reply to Open pipe to a function?

I'd like to use it in a larger script to log STDERR to a file.

You don't need a seperate program for doing that. You can just reopen STDERR to wherever you like:

open(STDERR, '>', '/path/to/logfile') or die "Can't open STDERR to /path/to/logfile: $!\n";

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated