From: Austin Ziegler Date: 2005-08-18T03:58:04+09:00 Subject: Re: Is there a simpler way to do this? On 8/17/05, astrodean@yahoo.co.uk wrote: > I believe the following does it... > the_string=File.readlines("/usr/blah/1.txt"').join Yes. But there's a problem with this -- it does more work than necessary. The IO.read approach that is superior. However, I prefer: contents = open(filename, "rb") { |f| f.read } It's not quite as short as the IO.read approach, but it does two things for me: 1. It's safe for text or binary files on all platforms. 2. Because I'm using "open", if I do "require 'open-uri'", then filename can also be a URL to a remoate location. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca