From: Josh Cheek Date: 2010-09-05T02:01:50+09:00 Subject: Re: p vs. print --001485f1ec90c5f3ad048f71ffd4 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Sep 4, 2010 at 11:02 AM, Chad Perrin wrote: > On Fri, Sep 03, 2010 at 04:40:45AM +0900, Quintus wrote: > > > > irb(main):003:0> print [1, 2, 3] > > [1, 2, 3]=> nil > > Are you sure about that? I get this: > > irb(main):001:0> print [1, 2, 3] > 123=> nil > > The result you showed should probably be produced by: > > print [1, 2, 3].inspect > > -- > Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] > Differences in versions. You can get an account at http://ruby-versions.net/and play around like this $ rvm ruby-1.8.6-p399,ruby-1.8.7-p174,ruby-1.9.1-p378,ruby-1.9.2-p0 -e 'print [1,2,3]' info: ruby-1.8.6-p399: ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux] 123 info: ruby-1.8.7-p174: ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux] 123 info: ruby-1.9.1-p378: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] [1, 2, 3] info: ruby-1.9.2-p0: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] [1, 2, 3] Going back further, it has been '123' as far back as Ruby 1.0 $ ruby-1.0 -e 'print [1,2,3]' 123 --001485f1ec90c5f3ad048f71ffd4--