You need to first break this problem into steps:
- Get the data: For this you probably want to look at LWP::Simple and then use loops and regex to parse each page.
- Store it: Use DBI for any database you like (under unix mysql is a decent and free system).
- Receive querys: CGI.pm is the way :)
- Look at the data: Go back to your database in step 2, you may need to learn some more SQL if you don't know it.
- Display results: Something like HTML::Template would be nice, but there are many other solutions for this step.
See what you can work out for those and then maybe come asking for furthur help on specific items.