#! perl -slw use strict; while( ) { chomp; if( m[/\*] ) { $_ .= until m[\*/]; s[\s?/\* .+? \*/\s?][]smg; } print join '-', split '\|'; }