That's where the \s* instead of \s+ comes in. \s+ assumes that there will be at least one character, but if you chomp and the only character on the line was a \n, then it will fail because there are no characters on the line anymore.
-----Original Message----- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 1:48 PM To: Timothy Johnson; Nikola Janceski; a a Subject: RE: Filehandle = blank line??? My code so far... $word = <DATA>; chomp $word; if ($word=~ /^\s+$/){ print "There is no word."; } -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 4:30 PM To: 'Allison Ogle'; Timothy Johnson; Nikola Janceski; a a Subject: RE: Filehandle = blank line??? Hmm. I'm not sure. Maybe if you post a little more of your code? $_ =~ /^\s*$/ should match any line where there are only whitespace characters or no characters at all. -----Original Message----- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 1:35 PM To: Timothy Johnson; Nikola Janceski; a a Subject: RE: Filehandle = blank line??? I did mean $word=<FILEHANDLE>. It was just written wrong in the e-mail. Sorry about that. -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 4:25 PM To: 'Allison Ogle'; Nikola Janceski; a a Subject: RE: Filehandle = blank line??? Ok, I guess I misunderstood the question, and maybe I still do. As I understand it, what you are saying with '<FILEHANDLE> = $word;' is "Store the value of $word into the default variable that results from reading the next line from FILEHANDLE", or something like that. Did you mean '$word = <FILEHANDLE>;'? -----Original Message----- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 1:27 PM To: Nikola Janceski; a a Subject: RE: Filehandle = blank line??? I will actually be storing the filehandle as a variable and then comparing it. Something like <FILEHANDLE>= $word; chomp $word; if ($word eq 'blank line') { ... } how would I use your suggestion in this case? if ($word=~ /^\s*$/) doesn't seem to work. -----Original Message----- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 3:53 PM To: 'Timothy Johnson'; 'Michael Stearman'; [EMAIL PROTECTED] Subject: RE: Filehandle = blank line??? he might have chomp it... safer would be: if($_ =~ /^\s*$/){ } shorter would be: if(/^\s*$/){ } > -----Original Message----- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 3:42 PM > To: 'Michael Stearman'; [EMAIL PROTECTED] > Subject: RE: Filehandle = blank line??? > > > > Maybe if($_ =~ /^\s+$/){ > do something... > } > > -----Original Message----- > From: Michael Stearman [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 12:46 PM > To: [EMAIL PROTECTED] > Subject: Filehandle = blank line??? > > > Hello all, > > I am stepping through an input file using the filehandle and > I need to do an > > if statement which recognizes whether the filehandle is a > blank line. In > other words, what I want to do is > > if ($_ eq 'blank line') { > ... } > > And I was wondering what I use to represent blank line. > Thanks for the > help...being so new to Perl this list has helped me a lot and > I am extremely > > grateful. Thanks again, > > Mike. > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------------- ---- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------------- ---- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. ---------------------------------------------------------------------------- ---- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]