Help for this page

Select Code to Download


  1. or download this
    my $dirname = '.';
    opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
    while (defined($file = readdir(DIR))) {
        if ($file ne '.' || $file ne '..'){print "$file\n";}
    }
    closedir(DIR);
    
  2. or download this
    my $dirname = '.';
    opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
    while (defined($file = readdir(DIR))) {
        if ($file eq '.' || $file eq '..'){print "$file\n";}
    }
    closedir(DIR);
    
  3. or download this
    opendir (DIR, ".") or die "$!";
    @dir = grep !/^\.\.?$/, readdir DIR; closedir DIR;