in reply to Create a html page on fly

Is this a permission issue.

Probably, but you need to check the error from your open to make sure. Either add use autodie; to your program (near the use CGI; line) or:

open HTML, ">", "tmp/$filename" or die "Cannot open '$filename': $!\n";

Improve your skills with Modern Perl: the free book.