|Here is an easier way: |$_ = <<'EOL'; | all text from here to that string above in single quotes goes into $_ | including the newlines. | next line intentionally left blank | | EOL #and this because its not on a line by itself |EOL |@lines = grep(!undef, split(/\n/,$_)); |print join("\n", @lines),"\n"; Not quite. I don't think split will ever produce an undefined array element. What it can produce is an empty string as an element, so: @lines = grep !/^$/, split /\n/; or @lines = grep $_ ne '', split /\n/; will split $_ into lines and remove any blank lines. Note that if you just want to remove *trailing* blank lines, split alone already does that. Brian ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch