s/[â¬]//g; #### open my $pdf, "<", "LeasevsBuy.pdf" or handleError($!); # you probably want to print out an error page instead of just dying. binmode $pdf; $output = do { local $/; <$pdf> }; close $pdf; print "Content-Type: application/pdf\n"; print "Content-Length: " .length($output) . "\n\n"; print $output;