#! perl -slw use strict; my $data = do { local $/; ; }; #! slurp the file into a scalar. $data =~ s/([^\n])(\n)([^\n])/$1$3/g; #! join the paras into lines $data =~ s/\n+/\n/g; #! reduce multiple \n's to 1 my @data = split/\n/, $data; #! and split. print for @data; __DATA__ 1 2 3 1 1 6 4 8 5 6 9 0 8 89 5 0 0 8 7 8 4 6 6 3 79 0 588 7 9 4 3 9 2 9 9 23 8 0 2 8 98 0 9 7 8 0 0 #### C:\test>216446 1 2 3 11 6 4 8 5 6 9 08 89 5 00 8 7 8 4 66 3 79 0 588 7 9 43 9 2 9 9 23 8 02 8 98 0 9 7 8 00