in reply to strip until blank line

This will strip all the lines preceeding the blank one:
my @data = <FILE>; while( $data[0] =~ /\S/ ) { shift @data; } print @data;
Update:
Just spotted quidity's post after fixing the error (d'oh), and the second point he raises is a good one; the following code would be better if you're reading from a file (the above code was designed to work whether you were working with data in a file or array, as you did not specify which you were dealing with):
while( $line = <FILE> ) { last unless $line =~ /\S/; }
which will leave you with FILE at the first line after the blank one.

Replies are listed 'Best First'.
Re: Re: strip until blank line
by quidity (Pilgrim) on Nov 23, 2000 at 00:10 UTC

    This will not work, as you are not shifting from what you think. Shift defaults to @_ or @ARGV depending on your current scope. You want to use:

     shift @data;

    which you now have. You don't really though, as this solution (as a whole) requires you to read the entire file into memory, which could be a bad thing.