in reply to How do I determine whether a folder is empty?

That first test puts glob in a scalar context. Each time it is called, it'll return the next item of the directory, until it returns undef. Thus, you'll get inconsistent results.

Don't use glob in a scalar context unless you plan to drain it each time in a loop.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: How do I determine whether a folder is empty?