From: Alex Gutteridge Date: 2007-08-23T11:33:17+09:00 Subject: Re: add outside variable to array elements On 23 Aug 2007, at 11:18, Ignatz Hafflegab wrote: > whole_file = open('16bytes', 'rb') { |f| f.read} > ar1 = whole _file.unpack('S*') > > puts('Enter an increase value') > incVal=gets.chomp > incVal.to_i This should be incVal = incVal.to_i. String#to_i *returns* the integer your String represents it does not convert the String object into an Integer. > ar2 = ar1.collect { |x| x + incVal} > puts ar2 There are some typos like the space in 'whole _file', but I assume those are just typos (use cut&paste). You don't say what error(s) you get, so it is hard to say what your problem is apart from the incVal.to_i part. Alex Gutteridge Bioinformatics Center Kyoto University