http://www.perlmonks.org?node_id=519388
Related Q&A: files, directories