On Fri, 1 Dec 2000, Raja S. wrote: > > These are just a snap shot of my "huh? -> aha!" transition as I learn more > about the ruby way of thinking. > > Raja [...] > --------------------------------------------------------------------------- > > Quirk: Printing hash literals as the first argument to print causes > syntax problems: > > print {'a'=>1, 'b'=>2} > > Fix: Precede by an empty string. > print "", {'a'=>1, 'b'=>2} or put brackets around it: irb(main):001:0> print ( { "a" => "b" } ) abnil > --------------------------------------------------------------------------- > > Problem: Default printing behavior (i.e., #to_s) of arrays/hashes doesn't > show structure > > Fix: Using #inspect [...] > Comment: irb shows the structure when evaluating arrays/hashes > > Shouldn't this be the default printing behavior of ruby? i.e., > shouldn't the default #to_s of arrays and hashes show their > structure? I think not. You can read in a load of lines from a file into an array. Then later you can print them all out at once without an interator. Hugh