You could use something like this: open MYFILE, "<$filename" or die "can't open the file: $!"; foreach $one_line (<MYFILE>) { push (@lines, $one_line) if $one_line =~ /\S/; } close MYFILE; # now only the non-blank lines are in @lines
Cheers, -L -----Original Message----- From: Craig Sharp [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 7:26 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] Remove blank lines from a file I have a simple question but I have brain lock. I need to parse a file and remove all blank lines from the file. Thanks, Craig _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs