Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Perl speed up looping

Avatar of mikeysmailbox1
mikeysmailbox1 asked on
Perl
5 Comments1 Solution210 ViewsLast Modified:
Hi

I have a large loop that is taking some time to execute and need to reduce increase the speed.


Main loop {
 
 open file A
 
 split and breakup the variables
   
 sub program {
 
     open file B
       split and breakup the variables
       if variable from Main loop = variable from sub do  another loop
           open file C
               if variable from current loop = variable from file B  do another loop
                   open file D (same file as A)
                     if variable from current loop = variable from file c
                         get data and store
                     }
                   close file D
               }
           close file C
           
       }
     close file B
     
  }
 
 
  sub program {
   
    simular looping as above but file B and file C are switched.
 
  }
 
 
  close file A    
 
 
  print data
 
 
}



The loops are working but the files can be large in size

I changed the foreach loops to while loops but not much change in speed.

Not sure if Greps will speed it up to search in the files instead of looping with while loops


Thanks,

Mike
ASKER CERTIFIED SOLUTION
Avatar of FishMonger
FishMongerFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers