You've got a pretty big task ahead of you,
alligator. I won't do your work for you, but I can give you a few tips for your outline.
- You have to get the HTML page out of the email attachment. I'd recommend to use a MIME parsing tool, such as MIME-Tools
- You'll have to extract the data out of the HTML file, and build a perl data structure (or insert directly into database). HTML::TokeParser::Simple is, IMHO, the most handy approach to tackle that problem.
- You can use Data::Dumper (which comes with perl) to inspect what your built data structure looks like.
- Use DBI to access the database, both inserting data into the database, and for doing the queries. BE forewarned, learning about DBI can take quite a long time... I recommend reading the DBI book. In addition, I like DBIx://Simple, which can reduce the code you need to write to make queries considerably.
- To convert your data back into a report, you can try using blocks consisting of here-docs. Or, you can look into a templating mechanism, like Template-Toolkit (home page, tutorial), or the simpler Text::Template, or even HTML::Template, if you're planning on just outputting HTML.
There, I think that covers the basics, I think.