in reply to Re^5: while loop logic
in thread while loop logic

If you remove the spaces from the left hand side of the substitution, or add the /x modifier, it will deal with all of those also. Not sure why I omitted the /x.

However, depending where the end of the comment comes, it can sometimes leave an extra newline, so an additional chomp is called for:

while( <DATA> ) { chomp; if( m[/\*] ) { $_ .= <DATA> until m[\*/]; s[ \s? / \* .+? \* / \s? ][]smgx; chomp; } print join '-', split '\|'; }

Any other late breaking 'funnies' you need to deal with?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.