I think File::Find is a module that you can use for this task..

if not you can do it the harder way, as

opendir(ROOT,'/web/web1/') or die "Can't open directory; @my_names = readdir(ROOT); # do a filetest(-d on each element of @my_names, # you can check directories thusly foreach my $elem(@my_names) { if(-d $elem) { # yup, its a directory } # push it onto a stack, for later processing else { # file, symlink.. so, check if its the file you <br>want to + process... and do stuff with it, or let it alone } }

So, have this stuff inside a subroutine.. first open the header directory, and pass a list of elements to the subroutine.. keep doing this recursively for each subdirectory you encounter..
HTH
Update: I see YoungPups has already recommended File::Find.. sound advice :o)


In reply to Re: Recurse through directories for file I/O by tinman
in thread Recurse through directories for file I/O by aconite

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.