# open current directory for reading opendir my $dh, '.' or die; # iterate through the entries while (my $dir = readdir($dh)) { # your code here } closedir $dh;