FWIW I did something similar some years ago. Unfortunately I have been unable to find where I put it. I used it to automatically process 1000 photos from a CD using perl-fu and the Gimp, and then generated the html. It made a 1000 page site for a server with no database to show hotel rooms for different units in a hotel chain. The code was somewhat similar to what would happen if you ran live off a db and used a template engine (I had HTML::Template). If you did the same probably it would probably take you a week or two and then about 5 minutes to run it. The nice thing was that you could slip new photos in and just run the thing again to rebuild the site. With all the Gimp photo windows opening up, highlighting being added and so on, it looked like an invisible photoshop operator was going nuts, so I called it Magic Hands.
So it's a lot of fun and people will freak when you show it to them, but still I'd recommend getting a server that has cgi and db access. It isn't that expensive these days.
If you already have a cgi based system running and you want to go through every state like you mentioned, then maybe WWW::Mechanize or even wget could be your pal.. well if I do find it I'll give you a copy but I think it's been consigned to the data dungeons!