unknown wrote:
> On Thu, 28 Sep 2006, Peter Bailey wrote:
> 
>> Well, I know that they're not always odd or even. They've been a mix of
>> both. But, I understand what you're saying. I will change my original
>> script. Basically, and, please tell me if I understand this correctly:
>> if I'm going to do a scan of a file, open the file, scan it, and then
>> close it. Right?
> 
> yup.  just remember to avoid this
> 
>    string = 'foobar'
> 
>    string.scan(%r/foo/) do |word|
>      string << 'foo'   # can't modify while scanning
>    end
> 
> regards.
> 
> -a

Thanks a lot, -a! I've cleaned up my code. But, if you notice way above, 
I've got a File.read in the line before the file scan. If I do an "end" 
for the file scan, my "read" is still open, right? Meaning, I can still 
do stuff to the open file.


-- 
Posted via http://www.ruby-forum.com/.