From: Peter Zotov Date: 2012-09-07T19:45:44+09:00 Subject: Re: cant change the string Ferdous ara писал 07.09.2012 14:32: > but I want > > if host_name =~ /^BD/ > host_name.gsub("BD","DK") > puts host_name > end > > so if hostname is BD, it will change it to DK (this number can be > change anytime) > So End result will be > > DK55 > > but its not working Generally, Ruby methods tend to return a new object rather than mutating an existing one. Mutating methods often have a bang postfix, i.e. "gsub!". This is not enforced by Ruby language itself, but is a useful convention. So, you need to use `host_name.gsub!("BD", "DK")'. -- WBR, Peter Zotov.