opendir(DIRHANDLE, $path) or die "Directory not available"; my @machinelist = grep{ /\.html/ } readdir(DIRHANDLE); closedir DIRHANDLE;