use strict; #-- Change the end of record character to read the whole file. undef $/; #-- Create the array my @ary = split (/\s+/,); print join(" / ", @ary); __DATA__ boop noop boop crep a1 a2 a3 a4 a5 b1 b2 c1 c2 c3 c4 d1 d2 d3