In article <NEBBLGCJOMNNCGJHPGMMGEOLLPAA.joe / vpop.net>,
Joseph McDonald <joe / vpop.net> wrote:
>
>
>> Here's the code:
>> ####################################################
>> i = 0
>> while true do
>>    i += 1
>>    puts i
>>          rptFile = "CYPsw00695.rpt" #a 190K text file
>>          srchStr = "/Error/"  
>>          rpt_h = File.open rptFile
>>          puts "after File.open #{rptFile}" if $DEBUG
>>          puts "srchStr is: #{srchStr}" if $DEBUG
>>          while rpt_h.gets do
>>            #puts "while: #$_" if $DEBUG
>>            if eval srchStr
>
>I wonder if eval is causing you problems?  It is probably
>slowing you down at least.  Can you do something like:
>  
>srchStr = "Error|Blah"    
>while line = gets
>  if line =~ /#{srchStr}/
>    puts line
>  end
>end
>

Actually, no.  The simple case is where srchStr is something like:
/Error/

but more complex cases exist like:

!(/Error/ || /Abort/ || /E[0-9]/ || /Warning/B)

(and these are read from several thousand files used in a system that is 
currently written in Perl, so it would be hard to change them all)

I don't think that the eval is the problem here (if it is, that could be a 
problem in itself).  Sure eval will be a bit slower, but it should 
continue to run.  It really seems like the system begins running out of 
some kind of resource as more iterations are run.

Phil