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

I am struggling to get a #if directive working. Do you know where there are some good examples? When I do this:
[<!--#echo var="raloption" -->]<br> <!--#if expr="'\$raloption' =~ /dd/" --> Some stuff <!--#endif -->
the #echo prints the value the I set() in the cgi. But the #if statement is never true. (perl 5.6.1, ActiveState, Win2K)

Code tags - dvergin 2003-12-09

Replies are listed 'Best First'.
Re: CGI::SSI #if problem
by Joost (Canon) on Dec 09, 2003 at 23:01 UTC
      It prints the value that I set using $ssi->set()
Re: CGI::SSI #if problem
by pingo (Hermit) on Jul 17, 2007 at 09:41 UTC
    This answer may be considered a bit... late. But since I happened to stumble over this question, here goes. It might possibly help someone else.

    You may want to remove the backslash from the expr. At least with a current CGI::SSI, with the backslash it evals this:

    '$raloption' =~ /dd/

    Whereas without the backslash, the module evals this:

    'abcdde' =~ /dd/

    (Or whatever $raloption is.)