Re: file reading and array's
| From: | DL Neil | Date: | Tue, 12 Feb 2002 10:52:05 +0000 |
| Subject: | Re: file reading and array's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84380@lists.php.net to get a copy of this message | ||
Hi Scott,
> In my constant effort to improve my perl conversion project, I have a
> question regarding file reading. I am taking two files and combining
> them in an array and then writing out a new file. Is there a way to:
> a)strip out the first line of the second file
> b)test for conditions based on what is on the next line on the file
>
> An example, I start the array on file one, then mid-way I start another
> array on the second file (this array within in the first). I need to
> check the next line in the file for a condition to exist.
>
> I have tried this, but run into the pointer resetting on each pass.
>
> Any thoughts would be appreciated. Thanks in advance.
Use explicitly array pointers instead of the 'built-in' ones, then:
your need to look-ahead becomes array[$ptr + 1]
avoiding the first record becomes for ( $i=1; $i<$last; $i ++ ) //instead of $i=0
Does that cover things?
=dn