akm2 has asked for the wisdom of the Perl Monks concerning the following question:

I wrote a short simple perl script to read existing html files. I use $text =~ s/\$(\w+)/${$1}/g; to expand variables. Will the sime type of technique on SSIs? Want kind of expression should I use?

Replies are listed 'Best First'.
Re: expanding SSI commands
by Masem (Monsignor) on May 01, 2001 at 02:02 UTC
    If you are trying to do these by hand, you're going to quickly run into major problems with SSI inclusions like this. It's much much much better to use something like Apache::SSI if you want to use the SSI mechanism, or a template solution (HTML::Template, Template, etc etc), if you want something a bit more robust for perl to handle.


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      I cant use a mod in this case. Thats why I need an expression.
        There is no reason that you can't use a module. Sure, you might not be able to install it in the standard locations, but if you find a module that you want to use, simply install it into a directory that you have control of, and then use the use lib functionality to point perl to use that.
        Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain