in reply to reading file from the end till some value is found

Hi,
Please read How (Not) To Ask A Question, especially the part about posting the code that you already tried yourself.
Regards,
svenXY
  • Comment on Re: reading file from the end till some value is found

Replies are listed 'Best First'.
Re^2: reading file from the end till some value is found
by Anonymous Monk on Feb 19, 2008 at 20:27 UTC
    Hi. Sorry, there was no try on my part, it was just begginers question if there is a command telling perl to start reading from the end of the file (and to my surprise googling didnt help). The answers below are appreciated (unfortunately i dont have mac). I found yet another package File::ReadBackwards and whe trying I bumped into a surprising problem: when I read xml file it is broken into individual letters instead of lines. And when I tried standard procedure
    open(DATAFILE, $file); while (defined ($line = <DATAFILE>)) { chomp $line; print $line } close(DATAFILE);
    and got the same letter soup. What is wrong? I tried to redefine end of line by setting local $/ as "something at the beggining of the file" and something not in the file but it doesnt helped (and did similar in File::ReadBackwards->new( $filename_in,"something as above" ))). Please help.