in reply to Eval in RegEx ...

Your issue is that print returns true if the print succeeded. So rather than print "<b>Hello World</b>";, you probably just want "<b>Hello World</b>"; (or return "<b>Hello World</b>";), since subroutines return the last thing evaluated.

As a side note, this sounds like you are doing something imprudent, either from a security or reinventing the wheel perspective. This type of templating is natural in Template::Toolkit, and might be worth a perusal.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: Eval in RegEx ...
by thakares (Acolyte) on Dec 06, 2013 at 16:05 UTC

    Though Template::Plugin is useful but not suit for my job.

    And secondly I'm very much fond of "reinventing the wheel"!!!

    Thanks anyway.

    P.S> I don't require too much templating, I've a specific job and that too without any additional modules, as on a very ligh weight and small system which has only core modules available (perl 5.8.8)

      Then you might consider running HTML::Template with a filter. Super-lightweight, no dependencies, pure Perl and compatible going way back.

      Was the issue resolved?


      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

        Thanks

        Issue resolved