From: Sean Russell Date: 2002-05-29T09:02:32+09:00 Subject: Re: PR for ruby John Knight wrote: > How to print the rightmost word for every line in ? .... >> perl -lane 'print $F[$#F]' .... > ruby -ne 'arr=split; puts "#{arr.last}"' #ruby version shows The ruby version is almost exactly the same as the perl version, only I think it is a little more clear: ruby -nae 'puts $F[-1]' You'll get nils in the output for blank lines; depending on what you want to do, filtering blank lines is probably appropriate, but a little longer: ruby -nae 'puts $F[-1] if $F[-1]' -- |.. "Real programmers don't document. If it was hard to write, it should <|> be hard to understand." /|\ -- anon /| |