in reply to Sort directories by date

Believe it or not, your question may actually be ambiguous. The "latest" directory could either be the one whose name represents the most recent month-day-year date, OR the one whose modification date is the most recent (i.e. the one that has most recently had a file added, deleted, renamed, etc.). The other replies above all take it for granted that the first of these two was your intended meaning.

But maybe those two possible interpretations happen to yield the same relative ordering of directories - that is, it could be that no changes ever occur in the contents of "09302015" once "10012015" is created (and likewise for the latter, once "10022015" is created). If this is true, you can sort the directories based on their modification dates:

my $dir = "/my_dir"; opendir DIR, $dir or die "$dir: $!\n"; my %subdir; while ( my $month_dir = readdir( DIR ) { next unless ( $month_dir =~ /^\d{8}$/ ); $subdir{$month_dir} = -M $month_dir; } my $latest_dir = ( sort {$subdir{$a}<=>$subdir{$b}} keys %subdir )[0]; # ...
Of course, if you really, truly meant for the actual directory names to be the basis for sorting, then the Schwartzian Transform is probably the most economical: instead of using the hash and while loop shown above, just do this:
my $latest_dir = ( map{s/(....)(....)/$2$1/; $_} sort map{s/(....)(....)/$2$1/; $_} grep /^\d{8}$/, readdir DIR )[-1];