in reply to Re: Opening every directory in the current directory
in thread Opening every directory in the current directory

You may as well get a list of the just the directories with the desired file, or else the open() in the original post's code will fail:
@DirList = grep { -f "$some_directory/$_/foo/bar.txt" } readdir DIR;