In these kind of cases it helps a lot if you tell us what you expected these statements to print and what they did print indeed. In this way we can deduct what you wanted to achieve - I, for example, have no clue what kind of behaviour you wanted to achieve with your code.
-- Hofmator
Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.