use File::Find; my @database; find(\&ofas, $db_path); sub ofas { push @database, $_ if /ofas\.db$/; }