In irb, I try to figure out why this doesn't work: irb(main):001:0> x=3 => 3 irb(main):002:0> 3.printf("%X") NoMethodError: private method `printf' called for 3:Fixnum from (irb):2 irb(main):003:0> x.printf("%X") NoMethodError: private method `printf' called for 3:Fixnum from (irb):3 irb(main):004:0> Why does printf act like a private method here? wg Wes Gamble wrote: > I am trying to print the hex representation of a string using printf. > > $stderr.print "Magic number is: #{magic_number}.printf('%X')\n" > > Why does this not work? > > The output is: > > Magic number is: %PDF-1.3.printf('%X') -- Posted via http://www.ruby-forum.com/.