Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: The dreaded if-elsif-else construct (code)by toma (Vicar) |
on Nov 18, 2001 at 01:42 UTC ( [id://126044]=note: print w/replies, xml ) | Need Help?? |
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: 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:
It should work perfectly the first time! - toma
In Section
Seekers of Perl Wisdom
|
|