my $fullpath = $webserver.$path.$to.$file; unlink $fullpath or dienice("Can't unline '$fullpath' Perl says the error is $!"); # with CGI let's avoid a 500 error sub dienice { print "Content-type: text/html\n\n" . shift; }