CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Need a logic for this program.



Oct 1, 2012, 10:14 PM

Post #1 of 2 (1502 views)
Need a logic for this program. Can't Post


I am beginner in perl, I am looking for logic for program for solving in perl language .
"I have 10GB log file, Which append the data to the end of the file every five minutes. I need to reverse the file like the latest input to first line of first page and the oldest data to last line of the last page of the log file. I can use only 1 GB of ram memory."

using 1 GB ram memory so we cant use the inbuild functions like reverse and other options.What would be the efficient way. Any algorithm or pseudo code would help me a lot thanks.

Veteran / Moderator

Oct 2, 2012, 12:43 AM

Post #2 of 2 (1500 views)
Re: [maneshmotts] Need a logic for this program. [In reply to] Can't Post


the best is probably to use the File::ReadBackwards module.

From the documentation of this module:

This module reads a file backwards line by line. It is simple to use, memory efficient and fast. It supports both an object and a tied handle interface.

It is intended for processing log and other similar text files which typically have their newest entries appended to them. By default files are assumed to be plain text and have a line ending appropriate to the OS. But you can set the input record separator string on a per file basis.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives