in reply to recursive function

I would prefer if you had spent as much time refining the specification within the question you're asking as we're likely to expend answering your question. As it is written, your question is vague enough as to garner multiple interpretations. Possibly one of us will get lucky, answering the question you intended to ask. But in the process, several of us will answer questions we thought you asked, which may completely miss the vague intent of the question.

My guess is that you have, as you said, a file that contains a directory tree... which I will assume means a list of paths. Each path must include a file name, since you said "full path to each end-file." So what you might have is this:

/foo/bar/baz.txt /foo/bingo/cantaloupe/commotion.json /bar/diamonds.dconf ...and so on...

Where these actual files come from, I don't understand, but I am going to go with the guess that you need to create paths, and possibly populate them with files that you might be copying from somewhere.

For full path creation, without the need to build paths piece by piece, look at File::Path, which has a make_path function. This function can create a full path all in one shot.

For copying files into those paths, there's File::Copy. Both File::Copy and File::Path are core Perl modules, so you have no good reason (outside of "for educational purposes") to not use them.

There is a non-core module which may also be helpful if you're willing to pull modules from CPAN (which you should be willing and able to do): File::Copy::Recursive.

Turning one or more of these modules into a full solution is left as an exercise for the reader, who must know a lot more about his question than we do. ;)


Dave