From: David Vallner Date: 2006-08-18T06:25:08+09:00 Subject: Re: reading website On Thu, 17 Aug 2006 22:15:10 +0200, fabsy wrote: > Thanks! > I've got it working.. > > --- > require "open-uri" > > > print 'Skriv in adress: ' > addr = gets.chomp > > > open(addr) do |addr| > fil = File.open('file', 'a') > fil << addr.read > fil.close > end > --- > > Is that a good way to write it? > I also saw that the first "word" in the file 'file' was > #.. What does that mean? > > It means you wrote an input stream object into the file. Which seems Weird. Wasn't there anything in 'file' before this script started? You set it to append, so that might be a leftover from some other script you wrote that used that file. Delete it, or open the file with the 'w' flag instead of 'a', and run it again? Also, you might want to avoid open(addr) {|addr| ... }, reusing the same variable name. It's probably not the issue here, but shadowing variables is inherently confusing. YMMV. David Vallner