One thing at a time all the time!

Welcome to Rocteur
Friday, April 26 2024 @ 11:43 PM CEST

How can I determine if a STDxxx is from/to a pipe ?

You probably want a filetest. Maybe you want -p, which returns true if
the filehandle is a pipe:

my $piped_output = -p STDOUT;
my $piped_input = -p STDIN;

Many people want -t, which returns true if the filehandle is attached
to a tty (i.e., a person).

my $interactive = (-t STDIN) && (-t STDOUT);

These filetests are documented in the perlfunc manpage under -X.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

FAQ Manager » Perl » How can I determine if a STDxxx is from/to a pipe ?