## which are finally assigned to the array ## 4 ## my @newest = ( ## This runs next, and sorts the directories ## 2 ## ## from most recent to least recent sort{ -M $a <=> -M $b } ## this runs first, generates a list of files/dirs in root ## 1 ## ## which it then reduces to just a list of directories grep -d, glob '/*' )[0..19]; ## then this "list slice" selects the 20 most recent ## 3 ## #### my @allFilesnDirs = glob '/*'; my @allDirs = grep -d, @allFilesnDirs; my @allDirsSortByDateTime = sort{ -M $a <=> -M $b } @allDirs; my @newest20 = @allDirsSortedByDateTime[ 0..19 ];