Dear Mr. pandey..If you first find the size of the file & then read the last 100-200 bytes or so..then try to find if there is a newline character in these bytes..if yes go ahead to split this with newline character and then take the last part(in case the end of line is new line character else any-way you can fix the input record seperator as reqd.) In case you do not find it then read last 300 bytes or so and continue till you find it...In this way you'll need only the minimum memory reqd.finding the size of the file in bytes is trivial any-way. As youknow youmay use read(FILEHANDLE,VAR,LENGTH,OFFSET) for ex.. let us suppose you have a file of 5000bytes.. now to get the last 100 characters from it
#!usr/local/bin/perl open(FILE ,"name_of_the_file_to_be_read"); seek(FILE, 4900,0); read(FILE,$ab,100); #note the last 100 bytes get stored in $ab close(FILE);
Now you can very well check for the newline character in $ab and then No need of any Module etc.... isn't it?? -MRT

In reply to Re: end of file! by mrt
in thread end of file! by vnpandey

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.