I've encounter a bug that has apparently happened before.

When using scalar reference template, HTML::Template dies producing the error:
"HTML::Template->new() : Unknown or unmatched TMPL construct at /fake/path/for/non/file/template "

I updated the error line, and it produces the output:
"HTML::Template->new() : Unknown or unmatched TMPL [T0B5AR] construct at /fake/path/for/non/file/template : line 6.
Chunk=<tmpl_var name="case_id"> . The reference number is located in the subject
 heading of this email.  at /export/opt/clarify/perl/lib/HTML/Template.pm line 2297, <F> line 56."

I'm only using the tmpl_var construct. The template itself contains several of them, but it doesn't always die on the same one. Sometimes it's the first one, sometimes it the third. There doesn't appear to be a pattern to it. The same template loaded from a file works perfectly (or has thus far).

I should note that the text for the template is being supplied from a .Net based Web Service, and the request and response encoding is set to UTF-8 (default).

When I replace the line: "$which = uc($1);" with "$which = $1; $which =~ tr/a-z/A-Z/", it works flawlessly.

The really weird thing is that I added some more debugging, and calling the uc function as part of an output string, such as:

'print "1=[$1][".uc($1)."]" 2=[$2] 3=[$3] 4=[$4]\n";' it works like a charm.

Even more weird is that this works perfectly on our development server, which is a near duplicate of our QA server where this is occurring. There is some difference in the installed modules, but nothing that should impact this (I think).

Please let me know if you need further information to help me diagnose this.

Thanks!