That's right. But let me add my 5cents to it. If you decide to use the
construct "while ( <MYFILE> )..." then it better be
while( defined(<MYFILE>) ) {
//...
}
[sathish]
-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 02, 2002 2:44 PM
To: Booher Timothy B 1stLt AFRL/MNAC
Cc: Hanson, Robert; [EMAIL PROTECTED]
Subject: RE: find blank line
On Jan 2, Booher Timothy B 1stLt AFRL/MNAC said:
>Thanks so much - only one problem: when I try to use while (my $line =
><MYFILE>) { etc } I get a bunch of errors similar to this one:
>
>Use of uninitialized value at JustForTest.pl line 13, <MYFILE> chunk 5.
>
>Do you know what I am doing wrong?
The code given you has an error. You read the line into $line, but the
regex is being tested on $_. Either do:
while (<MYFILE>) {
next if /^\s*$/;
# ...
}
or
while (my $line = <MYFILE>) {
next if $line =~ /^\s*$/;
# ...
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
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]