Newbee21369 has asked for the wisdom of the Perl Monks concerning the following question:
#### Need to keep this code unchanged opendir DIR, "Whatever/path"; @files=grep { !/^\.+$/ } readdir(DIR); closedir DIR; ####Need to return only files in code shown below. I have tried -f $fi +le, !-d $file, -e$file in my if condition and it is still returning F +iles and directories. foreach $file (@files) { if (-f $file) { #print whatever } }
20060801 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read only Files in a Directory
by Mr. Muskrat (Canon) on Aug 01, 2006 at 20:26 UTC | |
|
Re: Read only Files in a Directory
by swampyankee (Parson) on Aug 01, 2006 at 21:21 UTC | |
by Hue-Bond (Priest) on Aug 01, 2006 at 22:01 UTC | |
by swampyankee (Parson) on Aug 02, 2006 at 14:24 UTC | |
|
Re: Read only Files in a Directory
by jwkrahn (Abbot) on Aug 01, 2006 at 21:54 UTC | |
by johngg (Canon) on Aug 01, 2006 at 23:12 UTC | |
by jwkrahn (Abbot) on Aug 02, 2006 at 00:20 UTC | |
by Anonymous Monk on Apr 06, 2007 at 01:23 UTC | |
|
Re: Read only Files in a Directory
by zentara (Cardinal) on Aug 01, 2006 at 20:31 UTC | |
by zentara (Cardinal) on Aug 01, 2006 at 20:38 UTC |