First of all, I am by no means a brilliant programmer. I would call my self a business programmer. I do just enough to get it to work without making it as efficient as possible.

Alas, my incorrect attitude is biting me in the rear end now!! As I learn new languages, it is harder for me to understand what is going on. I have never used Perl before last Monday. In the last week I have read "Learning Perl" by Randal Schwartz. I am a “learn by doer” instead of “learn by reader”. I am now experimenting and want a script to do the following:

1 - Recursively search though the specified directory for all files with the ".txt" file extension.

2 - Store them all in an array or that hash thing (which I don't really get ... yet.)

3 - Search all the txt files for the letter combination "happy".

4 - Store all those files and file directory locations in another array or hash thing.

5 - Write the file directory and file name to a mysql db into table "Storage".

6 - Export an HTML file showing the names and locations of all the files to be viewed on a web page.

Since I am lazy (and sick of trying to figure it out myself (Where the heck does that // or \\ go again?)) will some please write me a dumbed down script to do all that?

Please don’t use any short cut stuff because I am trying to learn this and won't be able to understand it. I would be glad to repost the same script after I :

1 - Have understood it

2 - Figured out all the short cuts that should have been there in the first place to make the code as efficient as possible.

Thank you oh wise monks!!!

In reply to Search and store solution? by nukeboy

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.