in reply to foreach not working as I expected

why not use file::find? pesudo code:
use file::find find('*.txt',.,&doSomething); sub doSomething( my $fn = $_; open (YADA,$F "<"); )