I tried this before but it only works for single output. Actually I read the content ($html) from the template file which has many lines of Perl code to eval embeded in multiple <?perl ?> tags. For every string I had to define it first otherwise it says "Useless use of a constant (...) in void context at (eval ...) line ...".
Anyway thanks for reply.