$dirforimg="my_ip_number/test/images": opendir(DIR,$dirforimg) || die("Cannot open directory $dirforimg: $! $@\n"); @contents = sort readdir(DIR); closedir(DIR); # Format as clickable links foreach my $filename (contents) { print " $filename"; }