in reply to The dreaded if-elsif-else construct (code)

I recommend converting your directory structure to an XML file. Then you can apply any one of a number of excellent XML perl modules to the problem.

A hierarchical data structure is a natural for an XML document. For your case it could look like this:

<data> <sprocket_logs> <spacely>200</spacely> </sprocket_logs> <cog_logs> <cogswell>100</cogswell> <astro>1</astro> <maimed_a_robot /> </cog_logs> </data>
Producing this file should be relatively easy using File::Find to load up a data structure and one of the XML modules for dumping the data structure.

Then you have many choices for eliminating your big switch statement. Here are a few ideas that came to mind; there are better ideas, also:

The XML approach will be easier to maintain because the appropriate XML tools are in wide usage and worth learning anyway.

It should work perfectly the first time! - toma