On Thu, Jun 13, 2002 at 11:27:05PM -0700, tom poe wrote: > #! /usr/local/bin/perl -w .... > open (IN, "<$file") or die "Can't open $file: !$\n"; > while (<IN>) { > # Skip lines unless we have a blank line > next unless /^\s*?/;
Nope. The comment doesn't match your code. The code says "continue with the next line unless this line starts with *ZERO* or more spaces" So first of all, your regexp should be /^$/ Since you want to match an empty line or /^\s*/ To match an empty or pure whitespace line. 2nd, your code just drops this single matching line, so it would print the message including the header without empty lines. What you want to do instead is either to a. split the reading into 2 loops, first skipping all the header lines until you reach an empty line b. use a flag to tell when to start slurping the body my $slurp = 0; while (<IN>) { $slurp = 1 if /^$/; next unless $slurp; ... -- If we fail, we will lose the war. Michael Lamertz | +49 221 445420 / +49 171 6900 310 Nordstr. 49 | [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany | http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]