in reply to create an one-line format for this

As an alternative, read line by line and decide for each type what to do:

use strict; use warnings; while(<>){ print and next if /^\d+\s/; chomp; print if /^([A-Z]+|[.]+)$/; print "\n$_" if /^S+[.]*$/; print "\n" if m|^//$|; }