[Cialug] Perl - find blank/white line
Josh More
cialug@cialug.org
Tue, 12 Apr 2005 10:06:16 -0500
--=__Part6A497EF8.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
I would just use:
if ($line =~ /^\s+$/)
This would match all lines that start (^) and end ($) with whitespace
(\s) and have nothing else there (+)
-Josh More
>>>cniesen@gmx.net 04/12/05 9:55 am >>>
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
--=__Part6A497EF8.0__=
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Description: HTML
<html>
<head>
<style type=3D"text/css">
<!--
body { margin-bottom: 1px; font-variant: normal; margin-left: 4px; =
line-height: normal; margin-right: 4px; margin-top: 4px }
-->
</style>
=20
</head>
<body style=3D"margin-bottom: 1px; margin-left: 4px; margin-right: 4px; =
margin-top: 4px">
<DIV> I would just use:
</DIV>
<DIV> </DIV>
<DIV>if ($line =~ /^\s+$/)
</DIV>
<DIV> </DIV>
<DIV>This would match all lines that start (^) and end =
($) with whitespace (\s) and have nothing else =
there (+)
</DIV>
<DIV> </DIV>
<DIV>-Josh More
</DIV>
<DIV> </DIV>
<DIV><br><br>>>>cniesen@gmx.net 04/12/05 9:55 am >>><=
br>Hello Perl gurus<br><br>I'm having a program that reads lines and I =
want to find the first line<br>without a printable character and I am =
having problems creating the<br>correct condition.  So far I =
have:<br><br>  if ($line le " ")<br><br>But=
that treats a line starting with a tab as a blank line (aka the =
if<br>is true) but unless the tab is not followed by a printable =
character I<br>would like to tread it as a blank line.<br><br>If it =
helps, the lowest ord. of a printable character is 33 (!).<=
br><br>String functions prefered but regex is also accepted if need =
be.  Any<br>help is appreciated.<br>  Claus<br><br>Cial=
ug mailing list<br>Cialug@cialug.org<br>http://cialug.org/mailman/listinfo/=
cialug<br> </DIV>
</body>
</html>
--=__Part6A497EF8.0__=--