laziness, impatience, and hubris | |
PerlMonks |
Re^6: Find images regardless of filetype extension.by zzspectrez (Hermit) |
on Aug 01, 2005 at 14:15 UTC ( [id://479905]=note: print w/replies, xml ) | Need Help?? |
When I was writing this, I started off just looking for files in the current directory. So, my @files = map { "$dir/$_" } grep { !/^\.{1,2}$/ && -f "$dir/$_" } was nice and compact and seemed very perlish. I then decided to allow directory traversal and kept the same code format. Still nice and compact, only 3 lines compared to 10 in your method. Of course, mine is obviously way less efficient. I can't think of a way to eliminate the extra grep and stat and keep the same compactness. Thanks for you suggestion. zzSPECTREz please read my disclaimer
In Section
Cool Uses for Perl
|
|