Output streams in Perl: STDERR, STDOUT,
io, perl, unix
Solution
You can create a Perl file handle for an open file descriptor (fd) using `open`, appending `&=` to the mode and using the file descriptor as the file name. In your case, you'd use the following:
open(my $fh, '>&=', 3)
For example,
$ perl -E'
open(my $fh, ">&=", 3) or die $!;
say fileno($fh);
say $fh "meow";
' 3>output.txt
3
$ cat output.txt
meow
Problem
I know the output streams STDOUT and STDERR. Whenever you print to STDOUT, in a unix shell you can redirect the output like this... ``` deviolog@home:~$ perl test_script.pl > output.txt ``` or ``` deviolog@home:~$ perl test_script.pl 1> output.txt ``` When you print to STDERR, it looks the same but you switch to "channel" (?) number 2: ``` deviolog@home:~$ perl test_script.pl 2> output.txt ``` I can find in output.txt, what I was printing as error output then. My question is, can I access "channel" number 3 somehow? Is there something like ... ``` print STDX "Hello World!\n"; ``` ... that allows a redirection like the following one? ``` deviolog@home:~$ perl test_script.pl 3> output.txt ``` p.s. A subquestion would be about the term for those "channels" ^_^