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 ([]):

s/[â¬]//g;
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.

Next, move the close(PDF); to after the print <PDF>. You can't read from a closed filehandle.

Maybe what you really want is:

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;
Just guessing here.

Hope that helps.


In reply to Re: Passing Array to Function for search and Replace by Tanktalus
in thread Passing Array to Function for search and Replace by ikkon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.