[OT] Perl Question

Dan Nguyen nguyend7@cse.msu.edu
Mon, 27 Mar 2000 19:57:50 -0500


On Mon, Mar 27, 2000 at 07:53:34PM -0500, Benjamin Minshall wrote:
> Greetings:
> While Not EOF
> {
>      get line from text file;          # Syntax in Perl?
>     do HTML FUBARing on text line
>      output HTML_STUFF
> }
> 
> My question is: How can I read lines like this in Perl?  I've got
> everything else
> covered.  Thanks.

open FILE, "foobar" or die "$!";

while (<FILE>) {
  print '$_ will contain your line: ', $_;
}

or if you don't like having it in $_,

while (defined($variable = <FILE>)) {
  print '$variable will contain our line: ', $variable;
}


-- 
     Dan Nguyen     |  It is with true love as it is with ghosts;
  nguyend7@msu.edu  |  everyone talks of it, but few have seen it.
   dnn@debian.org   |                 -Maxime De La Rochefoucauld