[plug] perl program to strip blank lines from a file

David Buddrige buddrige at wasp.net.au
Mon May 17 15:36:47 WST 2004


Hi all, 

I am tryin to put together a program which will strip blank lines out of a 
text file.  To this end, I have written the following perl program; but it 
doesn't seem to work... can anyone see why?  To my mind, the regex ^$ should 
match lines that have no content, but this does not seem to be so... 

any help greatly appreciated... 

#!/usr/bin/perl 

while(<>)
{
   if(/^$/)
   {
   }
   else
   {
	print;
   }
} 

thanks 

David.



More information about the plug mailing list