Help for this page

Select Code to Download


  1. or download this
    opendir (DIR, $dir) or die "cannot opendir $dir";
    foreach my $file (readdir(DIR)) {
        &process_file ($file);
    }
    closedir (DIR);
    
  2. or download this
    my @only_files = grep {-f "$dir/$_"} readdir(DIR);
    foreach my $file (@only_files) {
        &process_file ($file);
    }
    
  3. or download this
    map {&process_file} grep {-f "$dir/$_"} readdir(DIR);