my @list = qw(. .. test.xls file100.pl); my $dot = qr/^[^\.{1,2}]/; my @files = grep { /$dot/ } @list; foreach my $file(@files) { print "$item\n"; }