From: Alex Gutteridge Date: 2007-11-22T14:38:14+09:00 Subject: Re: Problem printing variable with $stdout.print On 22 Nov 2007, at 12:58, Peter Vanderhaden wrote: > I'm a newbie to Ruby & OO programming, so please bear with me. I > searched the forum & didn't find anything relevant. I want to print > the > value of argv[0] to standard output, but I can't figure out the > syntax. > Below is one of the ways I tried, but it obviously doesn't work. I'd > appreciate any advice anyone can provide, along with syntax that will > get this to work. > Thanks > > $stdout.print "Invalid filename entered: argv[0] \n" The literal answer to your question is: $stdout.print "Invalid filename entered: #{argv[0]}\n" But that's probably not what you really want. Firstly, You probably mean ARGV instead of argv, so: $stdout.print "Invalid filename entered: #{ARGV[0]}\n" But that's (very, very nearly) the same as just: print "Invalid filename entered: #{ARGV[0]}\n" Which in Ruby is better written as: puts "Invalid filename entered: #{ARGV[0]}" This is the best place to get started IMHO: http://www.rubycentral.com/pickaxe/intro.html Alex Gutteridge Bioinformatics Center Kyoto University