Hey, there is something that has been bothering me for a long time. Bothering only, not making me unable to use Perl, because usually I found ways to "do it differently".
The problem is simple: I have a long string, with the word that I want to match several times in it.
Example: I open a file, which is itself a Perl Script, I read it in an array and join("",@) it in a single string. Let's say that I want to get rid of the statements that do the print "Content-type:text/html\n\n"; stuff. There can be several statements like that, and they can have different forms (print-one-space-string, print-as-many-spaces-as-you-want-string, print-parenthesis-string, etc.).
My approach is: I see that the expression I want to get rid of starts with print, and then the relevant string. So I want to match something that starts with print and end with the string, but how can I be sure that I am matching the print which is the closest to the string? (I don't want to get rid of a big chunck of my file that starts with any print and end with the string).
Thanks for your help (it must be an easy question for a real Perl Monk!)