Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Reading a line in perl Message-ID: <1990Sep25.173147.17841@iwarp.intel.com> Date: 25 Sep 90 17:31:47 GMT References: <903@iiasa.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 38 In-Reply-To: wnp@iiasa.AT (wolf paul) In article <903@iiasa.UUCP>, wnp@iiasa (wolf paul) writes: | Well, I took the plunge and started to use perl. You may regret that someday. :-) | The SYSLOG files, on which this is to be based, contain two lines | for each transmission, the first being for the message body, and | the second for the envelope/command file. I therefore need to process | the file in terms of two lines at a time. | | What I want to do is this: | | while ($line1 = ) | { | $line2 = getline INFILE ; | . | . | . | } | | but I cannot find a "getline" function. Is there a way, short of | writing my own getline function using getc? while ($line1 = ) { if (eof) { # handle line1 but no line2 error here last; # dumps you out of the loop } $line2 = ; ... } print "Just another Perl hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/