Next System Programming in Perl 20

Am I talking to a terminal device?

        @statinfo = stat STDOUT;
        if (    $statinfo[2] & 0060000 == 0020000
            && ($statinfo[6] & 0xff) == 5) { say "Terminal" }
        else { say "Not a terminal" }
        use POSIX 'isatty';
        if (isatty(STDOUT)) { say "Terminal" } 
        else { say "Not a terminal" }
        if (-t STDOUT) { say "Terminal" } 
        else { say "Not a terminal" }


Next 20