sub listfiles { $path = shift; $path = "." unless $path; opendir( DIR, $path ) || die "Can't open $path: $!"; !/^\./ and push @entry, "$_\n" while ($_ = readdir(DIR)); #removes the . and .. entries from readdir closedir( DIR ); return @entry; }