Gloom has asked for the wisdom of the Perl Monks concerning the following question:

I need to know what kind of file is my stdout ( tty or not ? )
I wanna use colors and "human placement" of data in my script but not if the output was redirected to a regular file or piped to another process. In fact, I dont find the egal of "isatty()" C function !

Did someone can show me the way of enlightment ?

Thank's fellow monks.

Replies are listed 'Best First'.
Re: What kind of file is my stdout ?
by moen (Hermit) on Jan 28, 2001 at 18:08 UTC
    You can use the -t switch on STDIN and STDOUT to test whether it's a file or an tty
    sub check { return(-t STDOUT); }
    Should return false or true.