in reply to Parsing a file one line at a time

It seems like you don't need to read the whole file in one go. Instead, you can process a line at a time.
e.g.:
open(FILE1, $ARGV[0]); $c=0; while (<FILE1>) { $line=$_; printf("line %2d: %s", $c++, $line); $ref=$1 if /^Referer: (.*)/; }
You can do the same for the other fields.

HTH

Replies are listed 'Best First'.
RE: Re: Parsing a file one line at a time
by chromatic (Archbishop) on Jul 23, 2000 at 08:34 UTC
    I'll raise you one and reveal the wonderful $.:
    while (<>) { printf("line %2d: %s", $., $_); $res = $1 if /^Referer: (.*)$/; }
    You can get rid of the open if you want to open the file specified as the first argument. $. keeps track of the current line number. (You ought to check your open call for success, too.)