Help for this page

Select Code to Download


  1. or download this
    # Filter out "." and ".."
    my @array = grep !/^\.\.?\z/, readdir(DIR);
    
  2. or download this
    # Filter out all "hidden" files
    my @array = grep !/^\./, readdir(DIR);
    
  3. or download this
    opendir (DIR, "/some/path");
    my @array = grep !/^\.\.\z/, readdir(DIR);
    closedir (DIR);
    
  4. or download this
    opendir (my $dh, "/some/path");
    my @array = grep !/^\.\.\z/, readdir($dh);
    closedir ($dh);
    
  5. or download this
    opendir (my $dh, "/some/path")
        or die("opendir: $!\n");