From: Martin DeMello Date: 2003-09-22T00:06:46+09:00 Subject: Re: RCR: New interpreter switch Eric Hodel wrote: > > Martin DeMello (martindemello@yahoo.com) wrote: >> while gets >> print $_.instance_eval { >> ... >> } >> end >> This would generalise the existing technique of mixing a few String >> methods like gsub and scan into Kernel and having them act implicitly on >> $_. > > Its already got that, use ruby -h. -n and -p do those things No they don't. For instance, calling the new flag -j (all the good names were taken!) ruby -n -e 'puts $_.split.join(" | ")' ruby -p -e '$_ = $_.split.join(" | ") + "\n"' ruby -j -e 'split.join(" | ") + "\n"' (and a nice convenience method to go along would be String#n, to add a newline to the end of a string, so we could say 'split.join.n') > Additionally: > > $ ri Kernel#gets [...] Yes, that was the 'existing technique' I referred to. martin