From: "Ara.T.Howard" Date: 2004-01-27T05:14:54+09:00 Subject: Re: Regurgitating the contents of a file On Tue, 27 Jan 2004, Joel VanderWerf wrote: > Date: Tue, 27 Jan 2004 04:38:03 +0900 > From: Joel VanderWerf > Newsgroups: comp.lang.ruby > Subject: Re: Regurgitating the contents of a file > > Josef 'Jupp' SCHUGT wrote: > > Hi! > > > > * Joel VanderWerf: > > > >>Philip Mak wrote: > >> > >>>What's the shortest way to regurgitate the contents of a file? I mean > >>>like this: > >> > >>puts File.read("filename.txt") > > > > > > AFAIK that reads the whole file to memory while > > It certainly does. But the OP did say "shortest" ;-) irb(main):001:0> 'puts File.read("filename.txt")'.size => 30 irb(main):002:0> '`cat filename.txt`'.size => 20 ;-) -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================