/\.\d+/ #### /\d+$/ #### my @directories = grep { /\d+$/ and -d $_ } readdir DIR;