[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problems with the "-x" file tests



Bill Hutten <bhutten@cochran.com> writes:

>I'm having a problem that's almost certainly attributable to my 
>stupidity, and i'd appreciate the lists' help:
>
>...given the following:
>
>
>foreach $item (@list) {
>	if (-d $item) {
>
>...where we have a list of files & directories in @list, why does the 
>"-d" test never evalate to true?

Chances are you got the list from readdir(), which does *not* return whole
paths, but only the last component of the name. You need to either do a
chdir to the directory, or prepend the directory name to $item.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "One fine day in my odd past..." -- Pixies, _Planet of Sound_

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch