deleting empty lines from a variable containing \n's

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I read a file and store it in a scalar variable...the file contains
lines with ### i need to delete those lines. When i substitute them i
get an empty line but not a deletedline. How do i achieve this ?


undef $/;
$file = <FILE>;
$file =~ s/^#+$//mg;
print $file;

If someFileContained
1) myCode
2) ###
3) furtherCode

The output is
1) myCode

2) furtherCode

I want output like
1) myCode
2) furtherCode


Site Timeline