How do I redo an array in ruby to an array of arrays ?

My data looks like this:

filename: call john doe_20120405_081431_
call john doe_20120405_081431_about car
call john doe_20120405_081431_about car_about offer
filename: till garden_20120405_081432_
till garden_20120405_081432_get gas
till garden_20120405_081432_get oil

The objective is to pull out the first <todo> and if "Update-YN:Y" then process just that todo. I am thinking I need to make an array from the original array splitting the elements upon <todo>. I will have many more than two elements however this is representitive data. This is a project for my learning.

My code thus far is:

@pimworking ='pim_working.txt')
puts @pimworking.readlines


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
I think you are looking for something like this

pimworking ='pim_working.txt').readlines

todos =
row =

pimworking.each do |ln|
  # there is no fallback for last of todos (so assuming series ends with <todo>)
  if ln.match(/<todo>/) then
    temp =  # make a shadow copy instead of reference
    todos << temp
    row << ln

puts{|ar| ar.any?{ |w| w.index("Update-YN:y")} }[0]

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TIMFOX123Author Commented:
This totally works.  

Been working on this too long  

thanks !!!!

Great job
Gertone (Geert Bormans)Information ArchitectCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.