I will post my modified code

Thanks! (Um, be sure to post the whole thing... -- I didn't see a line saying "use File::Find" when I read this post.)

Just one concept you should consider: doing a recursive directory search for files of a given type (e.g. *.js) is a very common facility that is handy for a wide range of particular needs -- that's why the GNU "find" utility (and the decades-old unix "find" that it's modeled on) is such a basic, essential component on so many systems (it's been ported to windows, etc).

Even if you want to stick with File::Find (which happens to be a few times slower than GNU "find"), you should consider making it a separate utility by itself, and keep just the editing function in a simpler app that works on a single file, or on a list of files read from stdin -- e.g.:

my_find_utility '*.js' | my_comment_extractor
This way, when you come up with some other particular edit or summarization process to be done on all files of a given type in a directory tree, you don't have to re-write the part that recurses through the directories. Just write a script that will apply the new process to any list of file names on stdin, and use the same front-end program (or GNU "find") to feed it.

In reply to Re: Re: Find, read, write out contents of a certain file type recursively... by graff
in thread Find, read, write out contents of a certain file type recursively... by Ro

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.