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:
#!/usr/bin/perl -w use Data::Dumper; while(<*>){ push(@files,$_) if(-d "$_"); } print "\n". Dumper(@files) ."\n";
will produce output like this:
sean@seanc:~/code/temp$ ls -l total 16 drwxr-xr-x 2 sean sean 4096 2008-09-17 09:12 dir1 drwxr-xr-x 2 sean sean 4096 2008-09-17 09:12 dir2 drwxr-xr-x 2 sean sean 4096 2008-09-17 09:12 dir3 -rwxr-xr-x 1 sean sean 155 2008-09-17 09:11 dir_list.pl -rw-r--r-- 1 sean sean 0 2008-09-17 09:12 file1 -rw-r--r-- 1 sean sean 0 2008-09-17 09:12 file2 -rw-r--r-- 1 sean sean 0 2008-09-17 09:12 file3 sean@seanc:~/code/temp$ ./dir_list.pl $VAR1 = 'dir1'; $VAR2 = 'dir2'; $VAR3 = 'dir3';
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 reply to Re: Log parsing question by eighty-one
in thread Log parsing question by thelamb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.