Heys,

Firstly - if you're reading the file backwards, does it not make sense to store the first line you get (which is the last line of the file), store it somewhere and then compare to that, rather than reading the file forwards first and then backwards?

The way I perceive the module as working is not too dissimilar to what you have:

use strict; use File::ReadBackwards; my $bw = File::ReadBackwards -> new ("log.txt") or die; while (defined (my $line = $bw -> readline)) { print $line; } $bw -> close;

That seems to work fine for me on Perl 5.61 (Suse 8.0). Couple of things that spring to mine - if the @last_current_schedule array you have defined involves non-numeric values, != will never be true (and hence the file will never be read) - you should be using ne - that tests whether strings are not equal.

Last thing I can think of is to check that all your variables are referenced correctly - that you're not overwriting any data you need and that it's not getting lost somewhere.
Make sure you have use strict; at the top of the script. It'd probably help to turn warnings on too - either use warnings; or use perl -w at compile-time (older versions of Perl). That should give you some idea, hopefully, as to where the script is falling over (it'll also tells you if you've done something stupid with a variable).

Hope that helps ..
--Foxcub.


In reply to Re: End of File Woes by Tanalis
in thread End of File Woes by Willman023

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.