use Path::Class; use List::Util qw(first); my $dir = $ARGV[0] || '.'; my $newest = first { $_ } sort { $b->stat->mtime <=> $a->stat->mtime } dir($dir)->children; $newest->is_dir ? say "Neustes Verzeichniss: $newest" : say "Neuste Datei: $newest";