|We don't bite newbies here... much|
Re^4: looping logic error while printing output from folder/flie contentby graff (Chancellor)
|on Dec 18, 2012 at 08:19 UTC||Need Help??|
Regarding the comments you placed in your output (which were very helpful):
(and likewise for the other two input files). This is happening because you are using the variable "$subdirlevel2" which is being set to the file name (minus the extension); you should set that to the appropriate directory name instead.
Your comment there is incorrect. You have opened two "container" tags, one nested inside the other, so you need to close tags, one after the other, to complete the structure.
Have you tried stepping through your code with the perl debugger? If you haven't learned to use the debugger yet, it's time to learn now. It's really very simple. (The full man page for it is here: perldebug, but you might want to start with perldebtut.) Set a breakpoint in your subroutines, and step through the lines of code in each one, checking the values that get assigned to variables, and what the various modules and functions are returning.
Also, take a closer look at how the sample code I suggested in my earlier reply is handling the information made available by File::Find. Read the man page for File::Basename more carefully. You might also need to consider what will happen when your program has to cover a different pattern of directory nesting.