Help for this page

Select Code to Download


  1. or download this
    # Sorts files in $dir and sets $latest->{file} with newest file.
    my $latest = (sort {$b->{mtime} <=> $a->{mtime}}
    ...
    map {{mtime => -M $_, file => $_}}
    <$dir/*>)[-1];
    my $oldM = (stat $oldest->{file})[9];
    
  2. or download this
    # Sorts files in $dir and sets $latest->{file} with newest file and se
    +ts $oldest->{file} with oldest file.
    my ( $latest, $oldest ) = (
    ...
        )[ 0, -1 ];
    
    my ( $newM, $oldM ) = map +( stat )[ 9 ], $latest->{ file }, $oldest->
    +{ file };
    
  3. or download this
    # Opens $dir and counts number of files
    opendir(DIR, $dir);
    ...
    $fCountL++;
    }
    closedir(DIRL);
    
  4. or download this
    # Opens $dir and counts number of files
    opendir my $DIR, $dir or die "Cannot opendir '$dir' because: $!";
    ...
    opendir my $DIRL, $dirL or die "Cannot opendir '$dirL' because: $!";
    my $fCountL = grep "$dirL/$_" !~ /\A\.\.?\z/, readdir $DIRL;
    closedir $DIRL;