develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [PATCH] [perl #8602] Clarify eof() example comments

Thread Previous | Thread Next
From:
Casey West
Date:
May 9, 2003 13:42
Subject:
Re: [PATCH] [perl #8602] Clarify eof() example comments
Message ID:
20030509204719.GU49820@geeknest.com
It was Friday, May 09, 2003 when Rafael Garcia-Suarez took the soap box, saying:
: Casey West wrote:
: > --- perl-current.orig/pod/perlfunc.pod  Fri May  9 00:58:19 2003
: > +++ perl-current/pod/perlfunc.pod       Fri May  9 07:35:51 2003
: > @@ -1326,9 +1326,9 @@
: >  
: >      # insert dashes just before last line of last file
: >      while (<>) {
: > -       if (eof()) {            # check for end of current file
: > +       if (eof()) {            # check for end of last file
: >             print "--------------\n";
: > -           close(ARGV);        # close or last; is needed if we
: > +           close(ARGV);        # either close or last is needed if we
: >                                 # are reading from the terminal
: 
: I disagree with that 2nd change.
: I don't see the point of closing ARGV is we don't read from STDIN, because
: $. isn't used. And if reading from STDIN, exiting the loop should be
: done after the C<print> :
: 
: >         }
: >         print;
: 
: I propose :
: 
:     while (<>) {
: 	if (eof()) {    # check for end of last file
:             print "--------------\n";
: 	}
: 	print;
: 	last if eof();  # needed if we're reading from the terminal
:     }

I accept.

  Casey West

-- 
"Windows NT 3.5 is not designed to route packets. . .so your Internet
Service Provider cannot be a Windows NT 3.5 box."
 -- Microsoft, 1995, on Win NT RAS


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About