if($line =~ /(^\s*)(\"[^*]*?\")$/g) {next;};

In addition to what others have said, the "message" piece of that has a typo. The character class, [^*] will match anything but an asterisk. I'm pretty sure you intended for that to be [^"] which will match anything but a double quote. Once you make that change, you can remove the ? and just greedily match.

Some of what you are doing is simply unnessecary. Since you aren't looking for more than one match, your /g modifier is unneeded. Also, quotations aren't regular expression metacharacters and they don't require backslashes. You don't need to capture anything; you only need to group the "message" part together and you can use (?: ... ) to do that. Finally, you are anchoring to the end of the line and that is probably not what you want as it'll miss lines with "messages" that have spaces after the message. (Actually, that part of your requirements isn't well specified. You might want to anchor it afterall, or you might want to allow \s* before the anchor, or you might not want to anchor at all. The second choice is probably the safest bet.)

Making these changes and making the "message" part optional as Aristotle pointed out and rearranging for readability like davorg did yields:

next if ($line =~ /^\s*(?:"[^"]*")?\s*/);
-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Blow off blank line and lines with messages by sauoq
in thread Blow off blank line and lines with messages by Anonymous Monk

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.