|We don't bite newbies here... much|
How do I replace certain character if condition existsby peppiv (Curate)
|on Apr 17, 2003 at 13:03 UTC||Need Help??|
peppiv has asked for the wisdom of the Perl Monks concerning the following question:
I've been using PDF::Create to make a PDF from info I pull from a DB. Works great (thanks tall_man). My only problem is that when info I pull that has a single parenthesis in the body, PDF::Create dumps out and cannot create the page. I'd like to replace the single parenthesis with a blank space (I've tried this and it works). I'd also like to leave the parenthesis if there's the opening and closing one (e.g. "Madrid (Spain)" is OK and works, "Madrid (Spain" is not and does not work).
Here's where I'm at:
This works in removing parenthesis from $results, but how can I catch them in the entire returned array? $results[1..80]? Also, how can I leave the parenthesis if they are placed correctly "(Spain)" not "(Spain"? This problem stems from the fact that some of this data came from user input and it wasn't controlled on the front end to filter them out.
This problem only appears to happen with parenthesis. It doesn't break with brackets or other characters. Since PDF::Create is no longer supported, I can't find a way to escape them in it's print to screen line ($page->stringl($f1, 9, 30, 352, "$results");
It's not like I can use the qq or anything.
Any help would be greatly appreciated! TIA
hey I love sports, but if it's such a macho thing, why do all these people punch, dunk and tackle for purses, belts and rings?