opendir(TARGET, $target); while($file = readdir(TARGET)) { &process_new_file($file) if $file =~ /\.xls$/; }