Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Good programmers vs. Logs

Good programmers vs. Logs

Good programmers vs. Logs

I would like to write a routine for reading logs but it enters into a loop and the CPU is almost completely taken. Can you suggest something?


foreach $on (@in){
push(@a, $_[0]);
push(@b, $_[0]);}
foreach $c (@a){
foreach $y (@z){
if ($c eq $y){$k=$c;}}
if ($c ne $k){

foreach $d (@b){
if ($d eq $c){
if ($x >0){
open(T,">>report/log.rep");print T"$x|$c|\n";}
foreach $l (@T){
open (TMP2,"file.html");
while (<TMP2>) {$_=~s/\[date\]/$T1[0]/g;$_=~s/\[calls\]/$T1[1]/g;
print $_;}


This counts the no. of call per day ($_[0]) but when the log file is too big (i.e. 2Mb) it cannot generate the report. It seems a loop :(

I read the log file, then I push the dates into 2 arrays. Then I compare them: I count how many times the date is repeated. The results are printed in a report file (rep.log).

Sorry. This is the first time I make something like this ... on big files!

Here is an example of the original log file (the real file is around 2Mb):


The rep.log should be like this:


Thanks in advance.

RE: Good programmers vs. Logs

Thank you for your response. Ok I'll try it. ... wait ... how can I list/print $datesummary{$date}, foreach date found?

Thank you very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close