Yes, I absolutely agree with you,
Happy-the-monk, I would also use
next unless -d $_; if I wanted to get only directories. And probably add a regular expression or something else to filter out the
. and
.. directories. Here, I only wanted to briefly answer the question in simple terms, and I had not seen that other answers to the original question also took up this point.