From: ChrisH Date: 2007-04-18T00:20:14+09:00 Subject: Re: exec with string in variables? On Apr 17, 10:53 am, Christian wrote: > Hi, > > i have something like this and more in perl and would transform it to > ruby. > First i changed system to exec and than the points to plus , but the > strings which are in the scalar's seems > not be applied in the exec call , perhaps some special needs with > quoting!? > > :perl > foreach $line(@methoden) { > system("$exe_path" . "dti.exe -qb -t -e$line $dom_file > $train_file $modell_string" . "$line" . ".dti"); > ................. > } > > :ruby > > methoden.each do |line| > exec("exe_path + dti.exe -qb -t -eline dom_file train_file > modell_string + line + .dti") > ............. > end > > many thanks christian String interpolation does this nicely: methoden.each do |line| exec("#{exe_path}dti.exe -qb -t -e#{line} #{dom_file} #{train_file} #{modell_string}#{line}.dti") ............. end