in reply to Why do I need a space here?

Try:
$i = "<HTML>\n"; print OUTFILE $i;
This has worked for me in the past. I don't think you need the back slash for that. You could also
$i = '<HTML>'; print OUTFILE "$i\n";
Sparky
FMTEYEWTK