Use the Escape-Character "\"....
I think this should work...

Best regards,

Holger Schell

SAP AG, 
68789 Rot (Germany) 
Non-ABAP Production Services
SAP Production
Student

Phone:  +49 6227 7- 66814
Fax:      +49 6227 78-38366
ROT15, CU.01

-----Ursprüngliche Nachricht-----
Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von prabu
Gesendet: Dienstag, 6. April 2004 14:46
An: [EMAIL PROTECTED]
Betreff: Pattern Matching

Hi,
    I want to match a pattern and replace with another string.Since the "?"
is also one of the character present in the string.
I am not able to do it.
Please help to how to make "?" acceptable in the string used for pattern
matching.

My problem is:
Here in the script,how to make the Perl to accept "?" symbol in the string
for pattern matching.

my $pattern="<a href=\"yahoo.com/getfile.php?id=1894\">Dennis";
my $replace="<script>\ndocument.write(\"<a href =
\"url+\"/getfile.php?id=1894\">Dennis";
open(IN, "<$filetoopen") || die "cannot open file\n";
open(OUT, ">$test") || die "cannot open file\n";
while (<IN>){
if (/$pattern/){
        s/$pattern/$replace/g;
}

Tell me in what way I need to give the "?'" symbol in the $pattern string,So
that string will be accepted.

With Thanks inadvance,
Prabu.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.620 / Virus Database: 399 - Release Date: 3/11/2004




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to