I have to admit that I found a lazy way to do just this - Data::Grouper. After four hours trying to do what you are doing, I decided that a nice general purpose module would be very useful.
Great! this is exactly what I wanted to do. Now, I am going to read Data::Grouper's code to figure out what it is doing behind the scene.
Thanks for mucking around with this for 4 hours. I just wasted my entire weekend on this. I would still like to know how to access vars named in horizontally same level blocks under "use strict."