opendir(DIR,$dirpath); my @A = readdir DIR; closedir DIR; ... my $entry = shift $A; ...