in reply to Quickly checking if a directory is empty
Path::Class offers a way. The module is portable across different file systems though the example is *nix. The main advantage to using this approach is it grows nicely and lets you pass things around easily.
moo@cow~>mkdir temp moo@cow~>perl -MPath::Class -le 'print Path::Class::Dir->new("./temp") +->children == 0 ? "none" : "some"' none moo@cow~>touch temp/fish moo@cow~>perl -MPath::Class -le 'print Path::Class::Dir->new("./temp") +->children == 0 ? "none" : "some"' some
|
|---|