Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^8: Find images regardless of filetype extension.

by zzspectrez (Hermit)
on Aug 02, 2005 at 05:10 UTC ( [id://480079]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Find images regardless of filetype extension.
in thread Find images regardless of filetype extension.

Ill give you that is compact!

But I think, that

  • my @files = map { "$dir/$_" } grep { !/^\.{1,2}\z/ && -f "$dir/$_" } @tmp;
is both compact but very clear and readable. On the otherhand,
  • map {$d="$dir/$_";$r= -d $d?\@dirs:\@files;push @$r,$d;} grep {!/^\./} readdir DIR;
is compact and clever but not easily readable IMHO.

On the other hand, I really like your use of the ternary and references. I would not have thought of using it like that. ++ ++ I think that is quite clever. Thanks for the snippet of code.

Only one complaint, the way you wrote you regex it will skip any dot file. So .my-file would not be picked up.

zzSPECTREz

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://480079]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-20 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found