in reply to RE: RE: keeping $$this defined locally
in thread keeping $$this defined locally

  • You probably should use a high-quality templating CPAN module, such as Template or Text::Template
  • If you insist on homegrowing your tmeplate module, the chief means of isolating variables within Perl are packages or hashes.
    1. For hashes, here's a snippet:
      { my %template_var; my ($key,$val) = split '=', $linefromtemplate; $template_var{$key} = $val; }
    2. And for packages, here's another:
      { package template_var; my ($key,$val) = split '=', $linefromtemplate; no strict 'refs'; $$key = $val;# left out symbolic dereference use strict 'refs'; }

      I woulda caught my error if we could preview replies to other posts...Why dont we enable that?