while (my $line=<$fh>) { chomp $line; for($line) { s/\&//g; s/[\\\_\@\_]//g; s/COMMENT//g; } my @data = split /:/, $line; my $class = $data[0] ? 'normal' : 'bold'; print $fh_out qq[]; my $ct=0; for my $word(@data){ $ct++; print $fh_out ''; if ($ct==1){ print $fh_out ''; } print $fh_out $word; if ($ct==1){ print $fh_out ''; } print $fh_out ''; } print $fh_out "\n"; }