Editing Topic: RCR164 Project: RCR | RCRchive home

RCR 164: New interpreter switch

submitted by martindemello on 2003-10-29 02:32:59


This is a legacy RCR. If this is your RCR, please resubmit it using the new format and process.


It'd be useful to have a switch for the following implicit loop:

while gets
  print $_.instance_eval {
    ...
  }
end
This would help the common use pattern of piping a series of lines through a script.

Old:

ruby -n -e 'puts $_.split.join(" | ")'
ruby -p -e '$_ = $_.split.join(" | ") + "n"'

New:

ruby -j -e 'split.join(" | ") + "n"'
ruby -j -e 'split.join(" | ").newline"'


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog