Peter Bailey wrote:

> RUBY's complaining about the following 3 lines of code. I've got it in a
> new program, but, I copied it directly from an older, working program.
> Can someone help me understand what's the problem with the "scan" line,
> or, apparently, the "each" line?
> 
> Thanks,
> Peter
> 
> 
> 10  Dir.glob("*.ps").each do |psfile|
> 11    file_contents = File.read(psfile)
> 12    file_contents.scan(/\%\%Pages: (\d{1,5})[ ]+\n/) do

Whoa. The error message suggests that the source string is being modified
while being read, but your listing stops before the part where that might
happen.
 
> Error message:
> 
> E:/PageCounts/test1.rb:12:in `scan': string modified (RuntimeError)

It's always a good idea to post a short working example in a case like this,
not just the part where you think the problem is. That would have provided
us with the true problem area.

-- 
Paul Lutus
http://www.arachnoid.com