From: Bertram Scharpf Date: 2007-08-23T21:32:11+09:00 Subject: Re: Renaming Files Hi, Am Donnerstag, 23. Aug 2007, 20:29:26 +0900 schrieb Stefano Crocco: > Alle gioved� 23 agosto 2007, Gabriel Dragffy ha scritto: > > irb(main):043:1> File.move( f, f.gsub!( /\s/, '_' ) ) > > You need gsub, not gsub!. [...] gsub, instead, creates a new string and > modifies it, so File.move receives two different strings. I suppose the evaluation order of arguments is left to right and f is handed over to File#move as long as it is the old version. Yet, before is gets used it becomes modified by its gsub! method. Independently from such considerations it is never a good idea to rely on evaluation orders anywhere else than in and/&&/or/|| expressions. If File#move were a method taking a block it surely were no good programming style either to modify f inside that: some_method( f) do ... ; f.gsub! ... ; ... end This is admittedly not a beginners topic and probably far from what Gabriel expected to meet. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de