arr = IO.readlines("myfile")lines = arr.sizeputs "myfile has #{lines} lines in it."longest = arr.collect {|x| x.length}.maxputs "The longest line in it has #{longest} characters."