in reply to Re: Parsing a file one line at a time
in thread Parsing a file one line at a time

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.)