develooper Front page | perl.beginners | Postings from May 2007

Re: Inconsistent results from file test (-X) operators

Thread Previous
From:
Chas Owens
Date:
May 16, 2007 18:35
Subject:
Re: Inconsistent results from file test (-X) operators
Message ID:
58ce48dc0705161835g36e78fdeg35c596ddaa66e747@mail.gmail.com
On 5/16/07, R (Chandra) Chandrasekhar <chandra@ee.uwa.edu.au> wrote:
snip
> Can anyone please tell me why I get this inconsistent behaviour and how to
> overcome it?
snip

It is not inconsistent, you are using file names without the proper
path.  If a file or directory exists in the current directory with the
same name as one in /usr you will get a result, otherwise there is no
file, so you are told false for both.  You can fix your code by either
prefixing the file name with the directory or doing chdir() into
$testdir.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About