my $db = $cgi->url_param('db'); my $datei = $cgi->url_param('datei'); download("/fester_pfad/".$db."/".$datei); sub download { my $file = shift; my $fn = (split "/", $file)[-1]; print $cgi->header(-type=>'application/octet-stream',-attachment=>$fn); }