#!/usr/bin/perl -w use strict; use CGI qw(:standard escapeHTML); use CGI::Carp qw(fatalsToBrowser); my $ausgabe = ""; my $downloadaufruf = ""; my $wert   = param('wert')   || ""; my $button = param('action') || ""; if ($button eq "Senden") {  $ausgabe .= "...senden gedrückt...
";  $ausgabe .= "Wert = $wert
";  download("test.txt");  $downloadaufruf = "alert('aha');"; } my $html = <<"(END OUT HTML)";    Test        
 $ausgabe      
    (END OUT HTML) print "Content-Type: text/html\n\n",      $html; 1; sub download {  my $file = shift;  print "Content-Type: application/octet-stream\n";  print "Content-Disposition: attachment; filename=$file\n\n";  open(FH,"<$file");# || die "mist";  binmode FH;  binmode STDOUT;  print while();  close FH;   }