my @dirtextfiles=(); while (<*>) { push (@textfiles,$_) if (-f "$_"); }