perl

Ben Coffman ben_coffman at hotmail.com
Tue Mar 2 23:17:43 CST 2004


After a little looking around I ended up using the "File::Find" module.  It 
gave me the freedom to do what I wanted with all of the below a specified 
folder and it is a lot easier!!

Thanks for the suggestion.

it sounds to me like you're losing your place.  The file test operators etc. 
have the
same concept of current directory as the rest of the program, they don't
automatically go relative or anything unless you chdir.

I reccommend using absolute paths all the time, or at least absolute paths
relative to the directory you are working with, instead of using chdir.

    opendir DIR, '/tmp';
    @entries = readdir DIR;
    @Files = grep { -f "/tmp/$_"} @entries;
    @Dirs = grep { -d "/tmp/$_"} @entries;
    print "Entries: @entriesnFiles: @Filesn Dirs: @Dirsn";
__END__

it is important to always use the directory name along with the directory 
entry
when examining file system entities, otherwise confusion can occur easily.

--
davidnicol at pay2send.com.
Include phrase "cat and buttered toast" to get through my filter

_________________________________________________________________
Find things fast with the new MSN Toolbar – includes FREE pop-up blocking! 
http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/




More information about the Kclug mailing list