In message <000501c13230$50f00210$[EMAIL PROTECTED]>
          "Louis-Philippe Dextraze" <[EMAIL PROTECTED]> wrote:

[snip]
> <CODE>
> 
> open FICMSG, "<$logfile" or print "problem opening log file.";
> 
> $i=0;
> while(!(eof FICMSG))
>     {
>     $msg[$i] = <FICMSG>;
>     $_ = $msg[$i];
>     if ($i < 40)
>         {
>         $i++;
>     }
>     else
>         {
>         $i=0;
>         }
>     }
> 
> for($i = 0; $i <= $#msg; $i++)
>     {
>     print "<b>Error $i:</b><br>$msg[$i]\n<br><br>";
>     }
> 
> </CODE>
> 
I'm not sure this code is doing what you think it is!
If your log is not exactly divisible by 40 then the order
of the lines in the array will not be the same as that in
the file. You should be doing something like:

while ( <FICMSG> )
{
  if ( @msg == 40 )
  {
     shift @msg;
  }
  push(@msg,$_);
}

> 
> My question is...can we read the file backwards.
> If I could set the reading pointer to the end
> of the file and then work my way back 40 entries.
> and print...now that would make my day.
> 
> anyone know of a way?

There is a module on CPAN for doing just this sort of thing:

  http://search.cpan.org/search?dist=File-ReadBackwards

Dave.
-- 
No, the fact that it's an infinite loop doesn't mean the program doesn't
work; it just entered a state with which I was previously unfamiliar.
     Calum - Acorna, A.McCaffrey & M.Ball
                   http://www.caledvwlch.co.uk/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to