Linux/Perl: Additional output buffers other than STDOUT and STDERR? -
Curiously, is it possible to create, instantize, or otherwise make additional output buffers in addition to STDOUT and STDERR from within Perl?
In the case of usage files or other commands there will be additional output for pipes, e.g. ./ doublerainbow.pl 3 & gt; Full_tune Txt 4 & gt; All_the_way! .txt
Absolutely. & gt; & Amp; =
with the Open
command allows you to open file sharing on arbitrary file descriptor.
# perl 4fd.pl & gt; File1 2 & gt; File2 3 & gt; File 3 4 & gt; File 4 5 & lt; File 5 open stdfo, '& gt; & Amp; = 3 '; Open STDBAR, '& gt; & Amp; = 4 '; Open STDABAg, '& lt; & Amp; Amp; = 5 '; # Works for input handles, very STDOUT print "hello \ n"; Printed STDERR "world \ n"; Print STDFOO "42 \ n"; Print STDBAR & lt; STDBAZ & gt;
$ echo pppbbbttt> File5 $ perl 4fd.pl & gt; File 1 2 & gt; File 2 3 & gt; File 3 4 & gt; File 4 5 & lt; File $ 5 cat file1 Hello $ cat file 3 42 $ cat file 4 file2 pppbbbttt world
Comments
Post a Comment