Don't re-invent the wheel, use File::Find for this sort of thing. Well worth learning.
In reply to Re: Procesing directories by myocom in thread Procesing directories by r.joseph