in reply to using strict; lots more errors

Well I'm not too sure about 1. but if you only have one action in your form then you could just try
if ( defined ($query->param('Action')))
I'd like to have all the code and run it to see what's really happening bfore I'd know for sure

For 2. You should really put and || die after the open statement to save yourself a lot of problemseg open(PUBFILE,">$pubfile") || die "Cant open $pubfile \n";