Mike Harris wrote:

> Paul Lutus wrote:
> 
>>Peter Bailey wrote:
>>
>>/ ...
>>
>>  
>>
>>>Thanks, Paul. And, I've tried that:
>>>
>>>   files = ARGV
>>>   files.each do |f|
>>>     f = f.to_s
>>>     f.gsub!(/-/, "..")
>>>     puts f
>>>   end
>>>
>>>I get a "can't modify frozen string" error message.
>>>    
>>>
>>
>>1. "f" is already a string, it doesn't need ".to_s".
>>
>>2. I ran your code without error, Ruby 1.8.4. Are you sure you posted the
>>same code you are testing?
>>
>>
>>  
>>
> Why use gsub! at all?
> 
> ARGV.each do |f|
>   puts f.gsub(/-/, "..")
> end

The OP is learning Ruby, he wants the string in its changed form for later
use, and the "puts" line is only present for debugging.

Your suggestion solves the frozen string error (the error I couldn't
recreate), but without meeting the original requirement.

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