Perlmonks is a place where other Perl users, on a strictly voluntary basis, help one another solve problems. Instead of posting code and asking us if it's right, post code *and the results of running it*, and ask us to resolve the differences between what you thought it would do and what it did. There's almost no reason to post code without running it first. Monks may be wrong about what it will do when executed, but the compiler won't. You should ask the compiler what your code does (by running it).
As for your code, it's not at all clear what you're trying to accomplish, but as it stands, you're doing scalar assignment to the same variables on each pass through the loop, as near as I can tell, so everything's going to get clobbered. That doesn't seem like what you want, but I could be wrong.