From: Justin Collins Date: 2010-10-20T04:02:29+09:00 Subject: Re: For the Ruby Newbie (?) with programming experience Don Norcott wrote: > I have had exposure to multiple programming languages and have made a > lot of wrong assumptions about code snippets I was looking at while > attempting to get a handle on Ruby. > > The Ruby Tutorial at this site is not a typical tutorial. It is short > and more like a collection of highlights (with code snippets) of the > ruby language. > > I found it immensely useful it relating ruby to other languages I was > familiar with. > > http://www.fincher.org/tips/Languages/Ruby/ > > Did a search on URL so do not believe this has been posted before. > > This is a decent resource, but just beware that some of it is non-idiomatic or misleading (in my opinion). For example, why is the 4th example using global variables? In the 12th example, why are there blocks after "if"? Some of the file examples do not close the file and while this is addressed, none of the examples use the much more common File.open "filename" do |f| ... end which ensures the file is closed for you. In example 22, there is this: rescue TruncatedDataError #the last read had less chars than specified #print the rest of the data. $! is the exception. # ".data" has the extra bytes print $!.data.gsub(/ err print err.data.gsub(/