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
use strict;
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.
Rudif
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.