use warnings; use strict; # Change input record separator to parse whole Verilog lines local $/ = ';'; while () { s/\s+/ /g; # Convert all whitespace to single-space print "$_\n"; } __DATA__ DFFX1 k0_reg_184 ( .D(key_184 ), .CLK(clk), .QN(n18736) ); DFFX1 k0_reg_183 ( .D(key_183 ), .CLK(clk), .Q(k0_183 ), .QN(n65993) );