On Jan 31, 2011, at 10:51 PM, Kamarulnizam Rahim wrote:

> I use the following codes:
>=20
> CSV.foreach('ActionPlan.csv') do |row|
>  next unless row[0] =3D~ /2.[a-z]/
>  t =3D Target.new
>  t.question =3D row[1]
>  pp t.question
> end
>=20
> And get the following results:
>=20
> "Routinely monitor energy use",
> "Identify major energy uses",
> "Improve inspection and maintenance procedures",
> "Routinely check environmental performance/compliance",
> "Routinely inspect your site for problems",
> "Monitor feedback on the environmental performance of your
> products/services",
> "Improve environmental performance of your products/services",
>=20
> My question is how do i collect all the results and put it into one
> variable?

You would collect them in an Array.  Put a line like this before the =
foreach loop:

  targets =3D [ ]

Then inside the foreach(), you could add to it:

  targets << t

Finally, you can make use of it after the foreach() loop.

James Edward Gray II=