From: Peter Bailey Date: 2006-11-30T02:58:30+09:00 Subject: Re: Need a range, but not getting it. . . . Paul Lutus wrote: > Peter Bailey wrote: > >>> puts ARGV.to_s.gsub(/\-/, '..') >> >> Yup. That certainly works, too. And, that's really simple. > > And it is wrong. "ARGV.to_s" collapses an array into a single string. If > you > provide more than one input argument, you will see the problem. > >> I guess I >> don't see why making "files = ARGV" throws me off so. I'm just trying to >> find the right mind-set for all this. > > The "right" mind-set is to process the array one element at a time: > > ARGV.each do |arg| > # do something here > end 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. -- Posted via http://www.ruby-forum.com/.