From: Gregory Seidman Date: 2008-07-13T22:24:10+09:00 Subject: Re: Dynamic Arrary Names On Sun, Jul 13, 2008 at 08:58:22PM +0900, M. Muzaffar wrote: > Is there any way in ruby to create dynamic array names? > > correctarrayfiles=Dir.glob("array_ast_correct_*.rb").size > correctarrayfiles.times do |num| > correctfiles=findbug.file_exist("array_ast_correct") > array+num=findbug.mark_arrary(correctfiles[num]) > end > > There would be then a new arrays like > > arrary0 > arrary1 > .... > .... You are overcomplicating. correctarrayfiles = Dir.glob("array_ast_correct_*.rb").size corrected_files = (0...correctarrayfiles).map do |num| correctfiles = findbug.file_exist("array_ast_correct") findbug.mark_arrary(correctfiles[num]) end Now corrected_files contains an array of whatever findbug.mark_arrary returns. This is semantically identical to your original code, though I think there are probably issues with the original code, including typos. > /Muzaffar --Greg