From: "Peña, Botp" Date: 2007-10-25T18:49:16+09:00 Subject: Re: puts from #!, but with data structure chrome from: Greg Willits [mailto:lists@gregwillits.ws] # Is there a way to run a #! script and cause output using puts (or # alternative) to actually show an array like ['a', 'b'] instead of just # ab ? > a => [1, 2] > b => {1=>2, 2=>3} > p a,b [1, 2] {1=>2, 2=>3} > puts a.inspect, b.inspect [1, 2] {1=>2, 2=>3} in ruby1.9, you can do puts a.to_s, b.to_s and p now returns array result (amazing) like, > RUBY_VERSION => "1.9.0" > p a,b [1, 2] {1=>2, 2=>3} => [[1, 2], {1=>2, 2=>3}] > x=(p a,b) > p x [[1, 2], {1=>2, 2=>3}] => [[1, 2], {1=>2, 2=>3}] nice for debugging/testing. kind regards -botp