From: Paul Brennan Date: 2012-08-15T21:49:00+09:00 Subject: Re: Variable in string in array Simply array =['An #{age} year old...'] Should work, no? Paul Brennan Technical Consultant Anthony Hodges Consulting Limited Highly Commended - European Pensions Communications Awards 2012 Highly Commended - Communications Specialist (UK Pension and Investment Provider Awards 2012) Winner - Communications Provider of the Year (UK Pensions Awards 2011) Winner - Communications Specialist (UK Pension and Investment Provider Awards 2011) Highly Commended - European Pensions Communications Awards 2011 Direct line: +44 (0)1924 203931 Switchboard: +44 (0)1924 203900 Email: paul.brennan@ahc.uk.com Website: http://www.ahc.uk.com Making a long term difference to the lives people lead Registered in England & Wales, registered no. 3559492 Registered Office: Heath Hall, Heath, Wakefield, WF1 5SL -----Original Message----- From: Dave Castellano [mailto:lists@ruby-forum.com] Sent: 15 August 2012 13:46 To: ruby-talk ML Subject: Variable in string in array Anybody know how to embed a #{} in a string and then place the string in an array? eg. array =["An #{age} year old..."] returns /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb:15 I tried adding single quotes array =[' "An #{age} year old..." '] and this accepted the string but the variable was also converted to a string, so lost as a variable. Thanks -- Posted via http://www.ruby-forum.com/.