Trouble with ARGV

Can anyone tell me what the problem is with this:

first, second, third = ARGV

puts "The script is called: #{$0}"
puts "Your first variable is: #{first}"
puts "Your second variable is: #{second}"
puts "Your third variable is: #{third}"

It’s returning:

The script is called unpack.rb
Your first variable is:
Your second variable is:
Your third variable is:

I can’t figure out why it won’t print the variables? Would really
appreciate any help. Thanks.

How do you call the script and which values do you expect in ARGV?

Here’s how I’m calling the script:

unpack.rb first 2nd 3rd

I expect the values to be: first second and third respectfully.

I did some researching and I think the problem is that I’m running Ruby
in a Windows Vista environment. I tried using ftype to associate the
correct path, but like I said, I’m extremely new to this and I’m not
having much luck.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs