Help for this page

Select Code to Download


  1. or download this
    opendir LSLRT, "$dir" or die "I hate you, $dir: $!";
    # rewinddir not needed
    ...
                     sort { $a->[1] <=> $b->[1] }
                     map { [$_, $mtime{$_} ] }
                     keys %mtime)[-5..-1];
    
  2. or download this
    my @last_five = chomp (`ls -1 --sort=time`)[0..4];
    
  3. or download this
    opendir LSLRT, "$dir" or die "I hate you, $dir: $!";
    my @files = (map { $_->[0] }
    ...
                     readdir LSLRT);
    closedir LSLRT;
    @files = @files[0..($#files > 3 ? 4 : $#files)];