On Mon, Oct 1, 2012 at 3:34 AM, Irfan Sayed <irfan_sayed2...@yahoo.com> wrote: > hi, > > i need to delete all blank lines from the text file > >
I usually just skip the blank lines when I read the data one line at a time. Then you can print to a new file. My example is below: #!/usr/bin/perl use 5.010; use strict; use warnings; while ( my $line = <DATA> ) { next if $line =~ /^$/; print $line; } print "\n"; __DATA__ line 1 line 3 line 4 line 6 line 8 **OUTPUT** line 1 line 3 line 4 line 6 line 8 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/