Perl file test

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: David A. Sinck
Date:  
Subject: Perl file test

\_ SMTP quoth Mike Starke on 11/14/2002 09:39 as having spake thusly:
\_
\_ What is the differance between the -f and -T file tests in Perl.
\_ My documentation says:
\_
\_ -f Entry is a plain file
\_ -T File is "text"
\_
\_ I had used -T to test whether it is a "plain text (ASCII) file",
\_ but it keeps returning false when I know it is true. Perhaps I do
\_ not understand what is meant by 'File is "text".
\_
\_ Can anyone enlighten me?

-f implies that it's not a socket, a directory, a block special file,
or the donut your kids wedged into your floppy drive

-T says that -f is true and that it doesn't have any suspcious looking
characters in the bytes it checked

FWIW, my docs say "-T File is an ASCII text file", so presumably a
control character (^M?) or something slipped in when you weren't
looking.

David