in reply to foreach problem

Thanks for the help. What you see is a much simplified version which helped me to come to conclusion that there is something wrong with the code. The hand-made command line parser was done on purpose as I wanted some really tricky argument processing and didn't know Getopt::Long. It will be a bit uglier to read with Getopt::Long but I will be able to do what I need. Thanks to pointing me in the right direction. I see I'm still just a noob.