The test snippet you showed us is difficult to decipher, since it's incomplete, and since there's a runaway quote in line 1 and 2. But one thing that is certainly a bug is this line:

$text =~ s/^[---]+//;

The biggest issue here is that you're repeating the hyphen inside of a character class, which is not useful. You probably intended something like this:

$text =~ s/^(?:---)+//;

The line right above that is flawed as well; you can't use (and don't need) alternation inside of character classes. The '|' character inside of a character class is just like any other character; it doesn't have any special meaning.

If fixing those problems doesn't help, you should post a complete snippet of code that will compile, and that we can actually run to see what the problem is. And the snippet should be no more than 20 lines of code.

Update: Could you explain what was wrong with the answers you received to the exact same question posted 16 hours earlier? (Split using special charater data type scalar)


Dave


In reply to Re: Split using special charater data type scalar by davido
in thread Reaped: Split using special charater data type scalar by NodeReaper

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.