use warnings; use strict; my @emptyfiles = grep { /\d/ } grep { -f } glob '*'; #### my @emptyfiles = grep { /^\d+$/ } grep { -f } glob '*';