Help for this page

Select Code to Download


  1. or download this
    my $dir = "/my_dir";
    opendir DIR, $dir or die "$dir: $!\n";
    ...
    my $latest_dir = ( sort {$subdir{$a}<=>$subdir{$b}} keys %subdir )[0];
    
    # ...
    
  2. or download this
    my $latest_dir =
      ( map{s/(....)(....)/$2$1/; $_} sort map{s/(....)(....)/$2$1/; $_}
        grep /^\d{8}$/, readdir DIR )[-1];