Amazing Perl output capturing `sniplet`
Here's a terrific little chunk of code I found while searching for a way to capture some output from a Perl script, the output of which was being used in a Server-Side-Include.
I wanted the ability to use the same script, capture the output into a variable, then "escape" the output for use as a javascript feed.
It works like a charm. All output going to STDOUT is captured into a variable without requiring any modification to your original subroutine.
You're then able to do some work on it before PRINTing it to the restored STDOUT.
Try it for yourself.
edit: Downloads/perl_stdout_capture.download...