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.";
|