Think about Loose Coupling | |
PerlMonks |
Re: Log parsing questionby eighty-one (Curate) |
on Sep 17, 2008 at 13:25 UTC ( [id://711991]=note: print w/replies, xml ) | Need Help?? |
This pertains to the second item you bring up.
I'm not 100% sure why you need to 'do it all in one go' as you say, so this may or may not be helpful. But, adapted from a node by an anonymous monk posted here, you can generate a list of directories within a specified directory.
You can use this to make your script adapt in case the number of or name of directories varies from run to run. This: will produce output like this: so you can always have an up-to-date list of subdirectories, and the code looks prettier than having a big, long hard-coded list. Changing the '-d' to a '-f' would give you a list of files, so you could adapt that to get a list of directories, then get a list of filenames or check for the presence of a particular file.
In Section
Seekers of Perl Wisdom
|
|