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


in reply to create directories while creating a file

I think you'll find that you MUST first create the dir and then the file; it's an OS issue. In one manner or another, the dir holds pointers to its files.

OTOH, as toolic suggested, you could create a dir and THEN create/store the file there and do both WITHIN a rather simple script. See perldoc -f mkdir for a function rather than a module.

You're on your own re the file creation though; you've provided insufficient info.