Sorry - I assumed a little too much about what you know about regular expressions.

In Perl regular expressions, unescaped parentheses signal that we're going to capture anything that matches the pattern inside the parens. There are no parens expected to be matched in the text we're analyzing; they're just a shorthand for "See this pattern here, between these parens? I want to save the stuff that this part of the pattern matches".

Here's an example. If we had this:

my($meta_thing) = ($string =~ /(foo|bar|baz)/;
we'd be saying, "please look for a 'foo', a 'bar' or a 'baz' string in the variable $string. If you find any of those matches, please save the thing you matched into $meta_thing". The pattern you have in the code you're looking at essentially says "please find an HTML comment that looks like this (don't save that); then skip however many whitespace characters you find (don't save those either); then start capturing every character you see up to the first time you find the other HTML comment (and save those); when you see the second comment, quit capturing, and save all the stuff you captured into /$cells. Don't save the second comment either."

The code after that is trying to break out table rows and cells from the stuff that was captured. Does that help clear it up a bit more?

I highly recommend reading perldoc perlre if you have no Perl books. I also recommend getting hold of "Learning Perl" if you want to learn more about this stuff.


In reply to Re^5: PERL scripts-Yahoo Groups Download-i get an error by pemungkah
in thread PERL scripts-Yahoo Groups Download-i get an error by Expansion

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.