# Analyzer.rb cannot run

**URL:** <https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311>\
**Category:** Ruby\
**Created:** [February 3, 2009, 12:07pm UTC](https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311 "2009-02-03T12:07:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cryxpride](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cryxpride](https://www.ruby-forum.com/u/cryxpride)\
**Post date:** [February 3, 2009, 12:07pm UTC](https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311/1 "2009-02-03T12:07:29Z")

</div>

Hi, I’m kinda new to this programmin thing and I’m currently using  
windows vista and it seems whenever I run this file:

line = File.readlines(“text.txt”)  
lines\_count = lines.size  
text = lines.join  
puts “#{line\_count} lines”

It will show :

> ruby C:/Users/administrator/analyzer.rb  
> \*\*\* WARNING \*\*\* Windows users should check the “Run process in terminal”  
> check box in the Debugger Preferences  
> to see STDOUT and STDERR output in real time.

C:/Users/administrator/analyzer.rb:2: undefined local variable or method  
`lines’ for main:Object (NameError)

> exit

and as you can see, there’s an error in the code but I can’t seem to  
find out what. I have attached the text maybe someone can run it and  
tell me what’s wrong?

Thanks,

Gen

---

<div class="post-metadata">

**Author:** ![cryxpride](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cryxpride](https://www.ruby-forum.com/u/cryxpride)\
**Post date:** [February 3, 2009, 12:16pm UTC](https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311/2 "2009-02-03T12:16:44Z")

</div>

Genocide L. wrote:

> Hi, I’m kinda new to this programmin thing and I’m currently using  
> windows vista and it seems whenever I run this file:
> 
> line = File.readlines(“text.txt”)  
> lines\_count = lines.size  
> text = lines.join  
> puts “#{line\_count} lines”
> 
> It will show :
> 
> > ruby C:/Users/administrator/analyzer.rb  
> > \*\*\* WARNING \*\*\* Windows users should check the “Run process in terminal”  
> > check box in the Debugger Preferences  
> > to see STDOUT and STDERR output in real time.
> 
> C:/Users/administrator/analyzer.rb:2: undefined local variable or method  
> `lines’ for main:Object (NameError)
> 
> > exit
> 
> and as you can see, there’s an error in the code but I can’t seem to  
> find out what. I have attached the text maybe someone can run it and  
> tell me what’s wrong?

The error message does tell you exactly the problem: it’s on line 2 of  
analyzer.rb, and the problem is that you referred to something called  
“lines” but no such thing exists. That is, there is no local variable or  
method called “lines”

On line 1 you created a local variable called “line”, not “lines” 🙂

HTH,

Brian.

---

<div class="post-metadata">

**Author:** ![cryxpride](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cryxpride](https://www.ruby-forum.com/u/cryxpride)\
**Post date:** [February 3, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311/3 "2009-02-03T15:47:01Z")

</div>

Ha ha, okay, I realized now. I copied the codes wrong too. Anyhow, I got  
it done awhile ago. Thankx yeah! 🙂

P.S. what does HTH means… -.-

---

<div class="post-metadata">

**Author:** ![cryxpride](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cryxpride](https://www.ruby-forum.com/u/cryxpride)\
**Post date:** [February 3, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/analyzer-rb-cannot-run/159311/4 "2009-02-03T16:18:24Z")

</div>

On Tue, Feb 3, 2009 at 8:46 AM, Genocide L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ha ha, okay, I realized now. I copied the codes wrong too. Anyhow, I got  
> it done awhile ago. Thankx yeah! 🙂
> 
> P.S. what does HTH means… -.-

In this group, it usually means “hope that helps”, or “hope that  
helped”.

You can google internet acronyms to see some others in use. There’s  
also a wiktionary page dedicated to such a thing:

[http://en.wiktionary.org/wiki/Appendix:Internet\_slang](http://en.wiktionary.org/wiki/Appendix:Internet_slang)

Todd
