use File::stat; # don't worry, it's part of standard perl #### @allPictures = sort {stat($a)->mtime <=> stat($b)->mtime} @allPictures;