From: 54Sandgroper Date: 2006-03-27T22:58:55+09:00 Subject: Re: Variables in REXML On Mon, 27 Mar 2006 21:24:48 +0900, Jerome Zago wrote: >> I can't work out how to do this... >> irb> i = 3 >> irb> puts root.elements['foo/bar[i]'].text > > Please try: > puts root.elements["foo/bar[#{i}]"].text Aha! The double quotes did the trick. I had unsucessfully tried puts root.elements['foo/bar[#{i}]'].text Thanks a million!