#filenames looks like this: category_Title Words_1 #SEARCH THROUGH THE CONTENT DIRECTORY AND FIND THE FILES THAT MATCH chdir("$contentdir");#change to the content directory my $stuff = ".";#make it $_ opendir THISDIR, "$stuff";#open the content directory my @submenu = readdir THISDIR;#put the names of the files in an array closedir THISDIR; ($sub1, $sub2, $sub3) = split (/\_/, $_,3);#split it on the underscores $sub3 = sort { $b <=> $a } $sub3;