I have an array which contains items that need to be renamed. =
Unfortunately the way things are changed are based on a comparison of if =
something else exists. For example in this simple array:=20

 names =3D ['sue,5', 'tom,6', 'jim,7', 'sally,8', 'fred,9', 'barney,0']


if my logic was if look at jim, see if fred exists in array, if so, =
change jim to Jim_Brown.=20

As I see it now I can't do a simple include? because my array isn't =
split properly. I've tried doing a grep, but that also doesn't work.=20

ruby-1.9.2-p290 :020 > names =3D ['sue,5', 'tom,6', 'jim,7', 'sally,8', =
'fred,9', 'barney,0']
 =3D> ["sue,5", "tom,6", "jim,7", "sally,8", "fred,9", "barney,0"]=20
ruby-1.9.2-p290 :021 > names.include?('fred')
 =3D> false=20
ruby-1.9.2-p290 :022 > names.grep('fred')
 =3D> []=20

One solution I see is to split the array into  a temporary second array =
and check that split array


ruby-1.9.2-p290 :023 > names.each do | ind |
ruby-1.9.2-p290 :024 >      ind_name =3D ind.split(",")
ruby-1.9.2-p290 :025?>   tmparray.push(ind_name[0])
ruby-1.9.2-p290 :026?>   end
 =3D> ["sue,5", "tom,6", "jim,7", "sally,8", "fred,9", "barney,0"]=20
ruby-1.9.2-p290 :027 > puts tmparray
sue
tom
jim
sally
fred
barney
 =3D> nil=20
ruby-1.9.2-p290 :028 > tmparray.include?('fred')
 =3D> true=20
ruby-1.9.2-p290 :029 > tmparray.grep('fred')
 =3D> ["fred"]=20


But there must be a better way that I'm simply overlooking, yes?=20

Wayne