in reply to CGI hanging during HTML generation (was : anyone have an answer?)

Soon some monks are going to say use CGI or die; - and they'll be quite right, because I think many of the things you are doing cd be done quicker that way (and probably more robustly: I'd hazard that whatever mechanism creates %formdata is not an improvement on CGI.pm's data parsing).

I'd like to encourage you to use two other CPAN modules, however (and if you need encouragement to use modules in principle, I'd like to offer that too - the modest effort in learning to use them is immediately repaid; and in fact looking through the guts of a module is a great way to learn Perl from the best):

1 CGI::Carp - will put lots of useful error messages onto your browser and help you find where your code is going wrong:
use CGI qw/:standard/; # you already did this! use CGI::Carp qw(fatalsToBrowser warningsToBrowser); print header; # and now you have sent a print header warningsToBrowser(1);
2 HTML::Template. As far as I see, you are opening an html file, then going through it making changes to it and sending the changed data to the browser. A templating module does much the same. But a well-thought-through templating module (I think HTML::Template is good'un - there are others) will do this in a way that
  • offers lots of features you will find useful
  • cleans up your code
  • doesn't break when you try to do something new
  • "hides information" - in the good sense of putting bits of your programme inside a box where you know they're doing their job but you don't have to bother about how they do it - leaving you more brainpower to do your stuff.

    Oh... also you are putting a -w after your #! /usr/bin/perl and following it with use strict; ... I presume. If not, the monastery will afford you many good arguments for why. The main one is: they help you catch your mistakes before they grow out of control.

    § George Sherston