[Cialug] Perl - find blank/white line

Aaron Thompson cialug@cialug.org
Tue, 12 Apr 2005 10:10:22 -0500


What do you mean by 'without a printable character'? I assumed from your
example that you were referring to white space.

If you looking for the first line that has white space:

  if($line =~ /\s+/)

If you are looking for the first line that starts with white space:

  if($line =~/^\s+/)

Good luck.

@


On Tue, 2005-04-12 at 09:55 -0500, Claus wrote:
> Hello Perl gurus
> 
> I'm having a program that reads lines and I want to find the first line 
> without a printable character and I am having problems creating the 
> correct condition.  So far I have:
> 
>    if ($line le " ")
> 
> But that treats a line starting with a tab as a blank line (aka the if 
> is true) but unless the tab is not followed by a printable character I 
> would like to tread it as a blank line.
> 
> If it helps, the lowest ord. of a printable character is 33 (!).
> 
> String functions prefered but regex is also accepted if need be.  Any 
> help is appreciated.
>    Claus
> _______________________________________________
> Cialug mailing list
> Cialug@cialug.org
> http://cialug.org/mailman/listinfo/cialug
-- 
Aaron Thompson                  Assistant Oracle Database Administrator
http://www.uni.edu/~prefect/                University of Northern Iowa

"All it takes to fly is to hurl yourself at the ground...  and miss."
                                                        -Douglas Adams