--000e0cd3f872481d7004a099f826 Content-Type: text/plain; charset=ISO-8859-1 Hi, Is your text source in the same directory as the ruby file you're running? I'm somewhat new as well, but copied/pasted what you had info a new ruby file, and it works fine here. On Sun, Apr 10, 2011 at 4:52 PM, Brett Kruger <brett.a.kruger / gmail.com>wrote: > Hello, I'm very new to Ruby, and trying to follow the examples in > 'Beginning Ruby' by Peter Cooper > > However, I'm completely stuck right at the beginning, trying to work > with File.open > > I have > > line_count > File.open("text.txt", "r").each { |line| line_count + } > puts line_count > > text.txt is in the same folder as my ruby file, and is ~ 100 lines of > text. However, line_count always outputs 0 for me. > > I've tried changing the syntax around, but I really have no clue what > the problem may be. > > -- > Posted via http://www.ruby-forum.com/. > > --000e0cd3f872481d7004a099f826--