in reply to Passing Array to Function for search and Replace
First, you want eq, not ==. eq is used for string comparisons, == is used for numeric comparisons.
Second, strictly speaking, you aren't removing characters for JPY and GBP. You're replacing the character with a space. Do you intend to do that, or do you intend to remove it?
Third, you probably want to put the characters in brackets ([]):
I'm not sure if you intend the comma to be a character to remove. Note that there is a huge difference here - what you had only removed the characters when they appeared exactly as-is, in order, one after another. This one will remove all occurences of any character in brackets.s/[â¬]//g;
Next, move the close(PDF); to after the print <PDF>. You can't read from a closed filehandle.
Maybe what you really want is:
Just guessing here.open my $pdf, "<", "LeasevsBuy.pdf" or handleError($!); # you probab +ly 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;
Hope that helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing Array to Function for search and Replace
by ikkon (Monk) on Jan 08, 2007 at 19:01 UTC |