* Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]> [2002-09-29 18:25]: > #!/usr/bin/perl -p > $_='' if !/\S/ && $e; # i.e. don't print if empty and last one was empty > $e = !/\S/; # remember if last one is empty...
Since you have already done $_='' in the first line, you don't need a regex in the second to set $e. You can just say $e = !$_; Although I'd use -n over -p here - more efficient and IMHO also less confusing. #!/usr/bin/perl -n $e = 0, print, next if /\S/; print unless $e++; __END__ Apologies if this has already been posted; I only just joined the list. -- Regards, Aristotle