Worked like a charm. Thanks tye. I'm still a bit of a novice to perl so I have one more basic question to your solution. I usually place my subroutines below my main code. When I did this with your code, it did not work. Only when I placed it above the main code it worked. What's the reasoning behind the madness?
Thanks,
Avi