in reply to printing xml declaration

I would check that whatever text is output (for the XML declaration) actually appears on the first line. It's quite possible you have an extraneous newline before this declaration (which may not be immediately obvious from a brief, visual inspection).

For your string, I'd suggest using single-quoting (q), rather than double-quoting (qq), and eliminate all the backslashes:

q{<?xml version="1.0" encoding="UTF-8"?>}

You can still embed newlines in a single-quoted string:

my $three_lines = q{Line 1 Line 2 Line 3};

Here's a real-life example taken from code I use daily:

q{<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet ...

I have no idea what Interwoven TeamSite is - if important to your question, please provide an appropriate link. If you have follow-up questions, please include all relevant code, input and output: paraphrased messages and prosaic code descriptions are far less useful.

-- Ken