From: "David A. Black" Date: 2008-12-15T21:11:47+09:00 Subject: [ruby-core:20569] Re: ruby -p behavior in 1.9 Bump. Sorry; I don't usually do this, but not sure what to put in book about this one so am escalating. David On Sun, 14 Dec 2008, David A. Black wrote: > Hi -- > > Is this expected/correct behavior for 1.9? (Today's SVN head.) > > david-blacks-macbook:~ dblack$ ruby19 -pe 'gsub(/a/,"b")' > a > -e:1:in `
': undefined method `gsub' for main:Object > (NoMethodError) > > david-blacks-macbook:~ dblack$ ruby19 -pe '$_.gsub(/a/,"b")' > a > a > > david-blacks-macbook:~ dblack$ ruby19 -pe '$_.gsub!(/a/,"b")' > a > b > > In other words, only gsub! with an explicit $_ has any effect. > > > David > > -- > David A. Black / Ruby Power and Light, LLC > Ruby/Rails consulting & training: http://www.rubypal.com > Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) > -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)