in reply to regexp for blank lines

If you have undef $/

@arr = split /\n/, $line; map {s/^\n+//;} @arr; $"="\n"; print "@arr"

if you are using while without undef $/, try the following

while ($line = <FILE>) { $line =~ s/^\n+//; }
the above codes not tested, try it out if it helps you

Prasad