in reply to Passing Array to Function for search and Replace

As for your second question,

my $file_name = "LeasevsBuy.pdf"; open(PDF, '<', $file_name) or die "could not open PDF \"$file_name\": $!\n"; binmode PDF; my $size = -s $file_name; print "Content-Type: application/pdf\n"; print "Content-Length: $size\n\n"; binmode(STDOUT); $/ = \4096; # Read 4k at at time. print while <PDF>; close(PDF); # Optional.

Update: Overlooked that $output was used without being set. Fixed.