http://www.perlmonks.org?node_id=941303


in reply to Mkdir failing

You can't use mkdir to create deeply nested directories in one go. But you can use make_path (or mkpath) from the (standard) module File::Path to do it for you.

oh, and you have to remove the newline from the end of each filename. A simple way to do that is using chomp.