The message part of your regex isn't optional. Append a
? to make it so. Your use of the
/g modifier there was misplaced - since you're already anchoring at the front and end of the string, the pattern can't match multiple times in the first place. Relying on the
$_ variable can also make your code much shorter.
while(<IN>) {
next if /^(\s*)("[^"]+")?$/;
chomp;
}
Update: [^*"] ->
[^"]. Thanks
sauoq.
Makeshifts last the longest.