I don't know what perl modules you are using, but the code to send a header should be quite simple. You probably have some code to set the Content-Type header somewhere already. You could add a line right next to it to set the vary header.
If you are using CGI.pm it might look something like this:
print $cgi->header( -type => 'text/html;charset=UTF-*', -vary => 'User-Agent' );
If you want advice specific to your situation, you'd have to say what type of perl modules you are using.