in reply to How to Set the 'tmpl_var' value in HTML::Template

I guess the problem with the special characters in the "tmpl_var".
The "special characters" are not might be the problem*. Based on my test, the reason you are not getting the expected result is because the template contains an error. Note the missing text, indicated below:
<TMPL_VAR NAME=NEW_A/B/C> ^^^^^

When I changed the template as indicated above, it worked fine for me.

On an unrelated note, I would avoid assigning to %hash and simply do $template->param( 'NEW_A/B/C' => 3 );.

HTH

*Update: Softened wording based on esper's comment (thanks for mentioning it).

Replies are listed 'Best First'.
Re^2: How to Set the 'tmpl_var' value in HTML::Template
by dsheroh (Monsignor) on Dec 29, 2007 at 08:35 UTC
    I suspect it's actually both. According to HTML::Template, "The "NAME=" in the tag is optional, although for extensibility's sake I recommend using it. Example - "<TMPL_LOOP LOOP_NAME>" is acceptable." Personally, I've never included the "name=" and it's never caused me a problem.

    However, I also only use alphanumerics and underscores in my key names. I wouldn't be at all surprised to find that HTML::Template needs a little extra help (in the form of an explicit "name=") to deal with the slashes. It does seem a little odd that just adding "name=" fixes it without also requiring the name to be quoted, though.

      I agree with esper and personally stopped using name= ages ago.

      What I don't understand is why you would use a variable name that looks nothing like a variable name. IMHO, it looks more like some weird regex or other obfuscated Perl code. You might want to check out Damian Conway's Perl Best Practices for some tips at naming variables. I'd get confused using variable names that look like that.

      "Fundamentals" my son.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

        yep. I too agree what you're saying.But I'm in tail end and the same  NEW_A/B/C value fetches from the database.
        If I really want to move out of the problem, then simply I can replace this with a very good practised words which is not a real solution for this problem.
        -kulls