Tips for golfing in Ruby
The numbers 100 to 126 can be written as ?d to ?~ in 1.8.
On a similar note if you need a single-character string in 1.9 ?x is shorter than "x".
If you need to print a string without appending a newline, $&gt;&lt;&lt;"string" is shorter than print"string".
If you need to read multiple lines of input $&lt;.map{|l|...} is shorter than while l=gets;...;end. Also you can use $&lt;.read to read it all at once.
If you're supposed to read from a file, $&lt; and gets will read from a file instead of stdin if the filename is in ARGV. So the golfiest way to reimplement cat would be: $&gt;&lt;&lt;$&lt;.read.