# Open up directory for reading the filenames if ( ! -d $directory ) { print "'$directory' is not found\n"; exit 1; } chdir $directory; opendir DIR, "." || die "Cannot open directory $directory\n"; # Look for '$filename' files... while ( $file = readdir DIR ) { if ( $file =~ /^$filemask/i ) { chomp; push @chk_files, $file; print "\n\t$file "; if ($Mode =~ /D/) {chomp ($dummy = );} # End of Mode } # End of IF } # End of While closedir DIR;