Want to create a file with variable name


#1

hi i want to create a file name, with that variable name…

for example…

a=10

f=File.open(‘a.txt’,‘a’)
created file name is a.txt
but
i want the file as 10.txt

can any one help??


#2

Try:

f = File.open("#{a}.txt",‘a’)

Regards, John.


#3

John Slobbe wrote:

Try:

f = File.open("#{a}.txt",‘a’)

Regards, John.

Thank You so much john…
its working.