Re: checking for an empty string

2002-05-28 Thread Tor Hildrum
> From: lz <[EMAIL PROTECTED]> > Date: Tue, 28 May 2002 07:08:52 -0700 (PDT) > To: [EMAIL PROTECTED] > Subject: checking for an empty string > > Hi guys, > > while($line = ) > { > if ($line =~ /^email address/) > { >} > } > > How can I check if $line contains a value or is empty? chomp

RE: checking for an empty string

2002-05-28 Thread Nikola Janceski
umm.. there's several ways. The following assumes you chomped the line already. see perldoc -f chomp if length($line) if $line # assuming it won't just have a 0 in it. if $line !~ /^$/ > -Original Message- > From: lz [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 28, 2002 10:09 AM > T

Re: checking for an empty string

2002-05-28 Thread David vd Geer Inhuur tbv IPlib
while () { if (!($_)) { if(m/^email address/) { } } } I think you want to be shure that you have input, so you match only if the current line is not empty. Regs David -- > > Hi guys, > > while($line = ) > { > if ($line =~ /^email address/) > { >

Re: checking for an empty string

2002-05-28 Thread Roberto Ruiz
Hi, God bless you. Assuming you are trying to read a line which contains: email addres: [EMAIL PROTECTED] Then you can use the postmatch variable ($') to look at the rest of the line (watch also for the change on the regexp that strips the ':' and any spaces after it). On Tue, May 28, 2002 at

Re: checking for an empty string

2002-05-28 Thread Roberto Ruiz
Ops, forgot to change blank for \s in regexp: On Tue, May 28, 2002 at 11:34:09AM -0500, Roberto Ruiz wrote: > Hi, God bless you. > > > while($line = ) > > { > > if ($line =~ /^email\saddress:\s*/) ^^ also change this. > > { See you Roberto Ruiz -- A train s