Good monks, Once again I apologize for disturbing your heavenly peace ;-). I come to you with this question:

I wrote a cgi script to emulate SSI behaviour and it works fine for the latest versions of perl (5.6.1+). Now I'm having to port this script to run under perl 5.005_02. I know this one is outrageously old, but one particular server I have to run the cgi on doesn't run any better ;(.

The cgi in question is http://www.e-vris.com/ssi_cgi.txt (http://www.e-vris.com/ssi.tar.gz)

While porting, I ran into this one problem where a regular expression would return 1 (true) on an empty string, whereas in perl 5.6.1 it returns 0, as is expected. For example,

. . . my $query = undef; if ($query =~ /^(([\w\d\-\_]+)[:,]|)(.*)$/) { # we get here! print "$`|$1|$2|$3|$4|$'|$query|"; } else { exit; } . . .
Any idea why the regexp operation evaluates to 1? There should be absolutely no match... Afterall, the query variable is undefined.

Your help is much appreciated ;-) Update: Gush... this was an obviously stupid question. Sorry for the trouble. I'll get on with porting (occassional brain farts are not pleasant, especially when exposed) ;-p



_____________________
"I'm always right and I can prove it, because to the best of my knowledge, I've never been wrong."

In reply to regexp issue: Porting script from 5.6.1 to 5.005_02 by vladb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.