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

[PATCH] [perl #8636] Fixup perlop example dealing with eof

From:
Casey West
Date:
May 9, 2003 05:14
Subject:
[PATCH] [perl #8636] Fixup perlop example dealing with eof
Message ID:
20030509121941.GG49820@geeknest.com
http://rt.perl.org/rt2/Ticket/Display.html?id=8636

The example was both confusing and slightly broken.  This patch clears
up the idea of the example.  It is to be applied on top of my latest
patch for [perl #8634] in message
<20030509105738.GD49820@geeknest.com>.

  Casey West

-- 
Hit any user to continue.

--- perl-current.orig/pod/perlop.pod    Fri May  9 08:11:45 2003
+++ perl-current/pod/perlop.pod Fri May  9 07:56:49 2003
@@ -484,10 +484,14 @@
     # parse mail messages
     while (<>) {
         $in_header =   1  .. /^$/;
-        $in_body   = /^$/ .. eof();
-       # do something based on those
+        $in_body   = /^$/ .. eof;
+        if ($in_header) {
+            # ...
+        } else { # in body
+            # ...
+        }
     } continue {
-       close ARGV if eof;              # reset $. each file
+        close ARGV if eof;             # reset $. each file
     }
 
 As a list operator:



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