On Monday 10 Feb 2003 11:57 am, Rob Dixon wrote:
Hope you do not mind in helping me out but have try what you put below with
know luck. This is what I have do and try many ways
sub main_prog
{
my $counter = 0;
my $counter1 = 0;
$filepos = tell FILEIN;
for(;;)
{
$filepos = tell FILEIN;
build_db();
$counter++;
alert();
$counter1++;
print "$counter..$counter1\n";
}
sleep 50;
seek $filein, 0, SEEK_CUR;
}
}
sub build_db
{
seek FILEIN, 0, SEEK_SET;
while ( <FILEIN> )
{
# seek FILEIN, 0, SEEK_SET;
does the stuff I want it to. # As you can see try different ways
}
}
But it still does not work can you maybe point out were I have gone wrong.
> Benjamin Jeeves wrote:
> > It still add record that it found on the first pass though the while
> > loop to my database what I need is some way to mark my file to the
> > point that it get to so it will not find a dupluted of the some
> > record as the file grows. ant ideas on how I do that.
>
> It sounds as though you want to keep checking to see if there are
> any records appended to the file? If that's the case then you need
> a separate scalar variable to keep track of the place in the file
> you've got to. Within your main loop, get the position with
>
> $filepos = tell FILEIN;
>
> then you can process the lines with
>
> build_db();
>
> wind back to where you were with
>
> seek FILEIN, $filepos, SEEK_SET;
>
> process them again with
>
> alert();
>
> then you can sleep and revalidate the end of file with
>
> sleep 50;
> seek FILEIN, 0, SEEK_CUR;
>
> ..and go back to the top of the loop.
>
> HTH,
>
> Rob
--
Thank You
Benjamin Jeeves
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]