From: Joshua Ball Date: 2008-12-17T14:11:24+09:00 Subject: ruby way of dumping file ------=_Part_16035_25876331.1229491145985 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Can someone give me a cleaner, more rubyesque (even correct) way of printing out the first 20 bytes of a file? My solution doesn't feel right. open(ARGV[0], 'rb') { |f| (0..20).each do |n| printf "%02d: ", n f.read(1).each_byte { | b | printf "0x%02x \n", b } end } Thanks. ------=_Part_16035_25876331.1229491145985--