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?
|
|---|