When I said "new" cgi.pm format, I meant changing the "old" method (as in printing out each javascript and html code line by line) vs the "new" method of using cgi.pm. Sorry if the term "new" is misleading and you can ignore the term.

OK, I understand. The shown conditional lines I would print line by line as before. CGI.pm is not able to do those conditionals. And it's not wrong or bad to print line by line. Don't feel bad to do it in that way. CGI.pm is not a programming roboter, it's only a tool to print html tags with some less source code and perfect headers/meta's etc.

For example: I have a script where I need serveral <input type=hidden name=samename value=differentvalue> Tags to build a array in the form. CGI.pm does not exactly takes the right value, it takes instead the value of the field bevor created. I don't know why it is, I fear it's a bug. And so I'm not ashamed to print the line manually.

Edit additional: It's not core competence of CGI.pm to create JS in all appreciative forms :)

When using CGI.pm, you don't have to put the javascript code in the head section, which is what is done when specifying it in start_html(). You can output it anywhere/anytime prior to the closing body tags. So, you CAN use CGI.pm to output your javascript.

If you post a short but complete script that demonstrates your problem, then we can guide you to the proper solution.

With all due respect, I was responding to FishMonger's request for some codes. If you do not find any use in rewriting it then that's your opinion...others may feel it looks cleaner. If you feel it is work for you then you don't need to respond. But I am just exploring the technical possibilities regardless whether it is of "use" or not.