use File::Find::Rule; my $directory = '/path/to/dir/'; my @fasta_files = File::Find::Rule->file->name( '*.fasta' )->in( $directory );