From: Peter Bailey Date: 2006-12-01T05:04:56+09:00 Subject: Re: Need a range, but not getting it. . . . Paul Lutus wrote: > Peter Bailey wrote: > > / ... > >> I ran it again, too, and, I still get the "can't modify frozen string >> (TypeError)" error. > > Well, rather than try to sort this out, why not make a copy of the > string > and solve it that way? > > Rather than: > > f.gsub!(/-/, "..") > > Do this: > > f = f.gsub(/-/, "..") > > BTW there is no purpose to this copy: > >>>> files = ARGV >>>> files.each do |f| > > Just do: > > ARGV.each do |f| That did it! Here's what I did. I need to not just turn the hyphen into range dots, but, I also need to get rid of any commas and stuff between input entries. ARGV.each do |f| f = f.gsub(/-/, "..") f = f.gsub(/,/, "") puts f end So, here's my input: test1.rb im145000-145004, im145006, im145009 I get: im45000..im145004 im145006 im145009 Phew. Thanks, everyone. Now I'm going to work on breaking down that range into its elements, but, I think I can handle that. -- Posted via http://www.ruby-forum.com/.