my @files = grep { -f $_ && m/1234yourhashvalue/ } readdir $dirh;