in reply to strip out lines until match

You say you don't care about it. So why not delete them too?

Put the lines in an array @lines. Now:
@lines = grep { $_ !~ /^[ \t]*\n?\r?$/ } @lines
And all blanks will be gone. Note that this one will harm your data sections if they contain and need blank lines.

Update: Changed regexp according to Enlil's reply.

Replies are listed 'Best First'.
Re: Re: strip out lines until match
by Enlil (Parson) on Apr 15, 2004 at 23:51 UTC
    I am guessing you meant
    @lines = grep { $_ !~ /^\s*\n?\r?$/ } @lines
    instead of
    @lines = grep { $_ != /^\s*\n?\r?$/ } @lines
    (i.e., s/!=/!~/).

    Also as a nitpick, \s is an abbreviation to the character class [\ \t\r\n\f] (reference: perlreftut)so the \n and the \r are never matched as the * is greedy (i.e. they are unnecessary).

    -enlil