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.)while (<>) { printf("line %2d: %s", $., $_); $res = $1 if /^Referer: (.*)$/; }
In reply to RE: Re: Parsing a file one line at a time
by chromatic
in thread Parsing a file one line at a time
by cburns
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |