# code ripped from perlmonks.org/index.pl?node_id=9277 chdir($filepath) || die "Unable to chdir to filepath"; my $filesize = -s $filename; # print full header print "Content-disposition: attatchment; filename=$filename\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/x-tar\n\n"; # open in binmode open(READ,$filename) || die; binmode READ; # stream it out binmode STDOUT; while () { print; } close(READ);