# Doubts about variables in ruby

**URL:** <https://www.ruby-forum.com/t/doubts-about-variables-in-ruby/180940>\
**Category:** Ruby\
**Created:** [January 1, 2010, 3:41am UTC](https://www.ruby-forum.com/t/doubts-about-variables-in-ruby/180940 "2010-01-01T03:41:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![junior\_linux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@junior\_linux](https://www.ruby-forum.com/u/junior_linux)\
**Post date:** [January 1, 2010, 3:41am UTC](https://www.ruby-forum.com/t/doubts-about-variables-in-ruby/180940/1 "2010-01-01T03:41:13Z")

</div>

well my doubt is:

I want to make a ruby program that number in a URL and checks if the url  
has a forum. for exemple :

puts(“enter an address”);  
endereco =gets()  
@forum = “/forum”  
system("firefox "+ endereco+ @forum);

the code does not work, it opens the page with the site but the variable  
@ forum runs only after I close the open page, and as command not found  
(like I try to use the command / forum)

how can i put it all together and make [url.com](http://url.com) / forum?

PS : Sorry for my spelling errors, I’m from Brazil 😃

---

<div class="post-metadata">

**Author:** ![junior\_linux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@junior\_linux](https://www.ruby-forum.com/u/junior_linux)\
**Post date:** [January 1, 2010, 5:57am UTC](https://www.ruby-forum.com/t/doubts-about-variables-in-ruby/180940/2 "2010-01-01T05:57:51Z")

</div>

On Dec 31, 9:41 pm, Junior L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the code does not work, it opens the page with the site but the variable  
> @ forum runs only after I close the open page, and as command not found  
> (like I try to use the command / forum)
> 
> how can i put it all together and make [url.com](http://url.com) / forum?
> 
> ## PS : Sorry for my spelling errors, I’m from Brazil 😃
> 
> Posted viahttp://www.ruby-forum.com/.

gets() retains the newline when the user presses enter  
try stripping the newline (endereco = gets().chomp)
