in reply to trim the blank lines...regex

You've already been given good advice, including RTFM which really is good advice here. Yet in the spirit of TIMDOWTDI (some of which don't involve regexes)...
while ( <> ) { chomp; print "$_\n" if length $_; }
{ local $/; my $contents = <>; $contents =~ tr/\n/\n/s; print $contents; }
If you're playing golf:
$/='';chomp,print"$_\n"while<>
print/./?$_:''while<>
print/./?$_:''for<>
If you're using one-liners:
perl -ne "print if/./"
perl -0pe "y/\n/\n/s"
perl -ne "/./&&print"