in reply to Working through directories

I agree with gav^.It would be much simpler (for coding and maintenance purposes) if you used either File::Find or Find::Recurse modules.