From: nobu.nokada@... Date: 2002-06-19T08:22:09+09:00 Subject: Re: in-place editing Hi, At Wed, 19 Jun 2002 07:31:53 +0900, Ian Macdonald wrote: > I'm trying to figure out why the following code chunk fails to edit my > file in-place: > > $-i = '.foo' # set in-place edit mode > mf = File.open('Makefile', 'r+') > mf.each_line do |line| > line.sub!(/-l\$\(RUBY_INSTALL_NAME\) /, "") > end > mf.close Inplace edit works for ARGF. ARGV.replace(['Makefile']) ARGF.each_line do |line| print line.sub(/-l\$\(RUBY_INSTALL_NAME\) /, "") end -- Nobu Nakada