in reply to Sort directories by date

It would have been much easier if you'd created the directory names as 'YYYYMMDD' then they would have sorted naturally with little effort.

BTW, opendir/readdir are too low level and always a pain to use unless you really have to. You could try File::Find::Rule instead

use v5.20; use warnings; use File::Find::Rule; my @dirs = File::Find::Rule->directory()->maxdepth(1)->in('.'); say $_ for @dirs;