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