in reply to Re^2: Nested loops
in thread Nested loops

As nuance stated, $a and $b are special variables to perl (used in things like sort. They don't need to be declared with my because of this). It's highly advisable that you don't use these special variables except for where they are normally expected.