Re: file reading and array's
| From: | Scott | Date: | Tue, 12 Feb 2002 21:32:43 +0000 |
| Subject: | Re: file reading and array's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85077@lists.php.net to get a copy of this message | ||
Perfect! Thank you, my mind was out in left field somewhere.
On Tue, 12 Feb 2002, DL Neil wrote:
> 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
>
>
--