Please be careful on Win32. I found out that testing for -T _ and -x _ may give erroneous result, depending on the order of tests. I believe this to be a bug in the Win32 Perl.
Here is a simple script to illustrate the problem:
#! perl -w
my $file = 'test.bat';
print "1. $file is a text file, executable\n" if -T $file && -x _;
print "2. $file is an executable text file\n" if -x $file && -T _;
Create a simple file named test.bat and run above script.
It prints only this - not what I would expect
2. test.bat is an executable text file
See also this node and the replies:
Problem with filetest -x _ on Win2k AS Perl build 626