Hi again, steph_bow - I guess since I got you started down this road, I might as well keep you going. :) By the way, I note that you're still using a 'BEGIN' block in your code without any specific reason; you should probably read up on these special blocks (the section is called 'BEGIN, UNITCHECK, CHECK, INIT and END') to find out what they're for - and you shouldn't use them gratuitously.

File::Find is a nicely-documented module; you should read up on it by typing 'perldoc File::Find' (the exact case is important) at your command line. The short version, however, is that the 'find' function takes a sub reference as its first argument and a list of directories as the second - as starbolin mentioned. From what I see in your code, you mostly need to learn how to permute lists of directories - something like the following:

(pseudocode)
(A B, C) x (D, E, F) = (A/D, A/E, A/F, B/D, B/E, B/F, C/D, C/E, C/F)

In the example that I gave you the last time, I cheated a bit and used brace expansion in the glob statement - i.e., I used the shell to do the work (*bad, bad me...* :) This time, however, I'll do it "the right way", by using 'map':

use warnings; use strict; ### Make up some numbers :) my ($week, $date) = qw/36 250/; my @regs = qw(LAR30 TYE68 SOK96); ### Interpolate the directory lists @dirs = map { "../ALL_WEEKS/semaine_$week/semaine_${week}_TACOT/day_$date/r_$dat +e/$_" } @regs; ### Now that we have our list of directories, process them find(\&process, @dirs); sub process { ### Do stuff to the files returned by File::Find (represented by ' +$_') print "File name: $_\n"; }

-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells

In reply to Re: how to use file::Find ? by oko1
in thread how to use file::Find ? by steph_bow

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.