Help for this page

Select Code to Download


  1. or download this
    opendir DIR, q{.} or die $!,$/;
    my $last;
    ...
    }
    print $last; ## this prints the last file
    closedir DIR;
    
  2. or download this
    opendir DIR, q{.} or die $!,$/;
    my @files = readdir DIR;
    closedir DIR;
    print $files[-1];  ## this prints the last file
    
  3. or download this
    ## sorted by name, case sensitive
    my @files = sort {$a cmp $b} readdir DIR;