First thought that comes to mind is use
@files=glob("/Library/WebServer/Documents/userpages/uploads/*.*")
to get the listing of files. then you could replace the foreach with
foreach (@files) {
print "<br> Delete this File: <INPUT TYPE=\"checkbox\" NAME=\"files\"
+VALUE=\"$_\">\n";
}
Then use cgi.pm in upload.cgi to decompose the returned parameters and allow for the deletion of multiple files. something like
foreach ($query->param('files')){
unlink($_);
}
Please be warned that this is hideously insecure as it stands it would allow someone to pass any file path they want, and if the web servers user had permission, they could delete important files.
it would be better to change to the directory in question to all the file paths returned are relative, rather than absolute, and to regex away any .'s and /'s in the parameters returned.