... while (my $pattern = ) { next if $pattern =~ /^\s*$/; ...