... while (<$inFH>) { chomp; # reject if 0 or more spaces anchored to start and end next if m{^\s*$}; print qq{-->$_<--\n}; } ...