Hi all,

I have a piece of data like so:

aaaaaaa
bbbbbbb
ccccccc
123
ddddddd
yes
eeeeeee


I need to find the string yes and the string 123, however I first have
to find the string yes. I have this code to do this task:

stack = "aaaaaaa
bbbbbbb
ccccccc
123
ddddddd
yes
eeeeeee"

string = "yes"
stack.each do |c|
        c.each {|line|
        line.chomp!;
                puts line.strip! if line.include? string}
end


How can I then, using 'yes' as my index to find the string '123'?
Basically I need to first find 'yes' and once discovered, search back to
find '123'. I hoep I explained it well enough.

I have thought about using pop, to pop the values off from an array but
I am not sure how to do this.

Could someone please give me a pointer to achieve this?

Thanks!
-- 
Posted via http://www.ruby-forum.com/.