opendir(DIR,$dirpath); my @A = readdir DIR; closedir DIR; ... my $entry = shift $A; ... #### if (-f "$dirpath/$entry")