There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
When I run exactly the code you posted, I get:
So for this to be failing for you, then one of two things must be the case: One, the target string is different. Or two, the contents of $oldstring is different. This is why I asked what happens when you add print "<<$oldstring>>\n";. And as you said in a followup post, you get <<hello.doc>>. I believe that you are not making this up; that you actually ran your script with print "<<$oldstring>>\n";. So since we've verified that $oldstring contains what we expect, that leaves the other possibility, that $string doesn't contain what you expect. So, what happens when you add this instead?
If you add that immediately ahead of your "if(..." statement, we can verify that those two variables contain what you expect them to contain, nothing more, nothing less. Once you've verified that they contain exactly what you expect them to contain, if you still have an issue, then we have something pretty interesting to investigate. ;) On the other hand, if they contain something different than what you expected at that crucial point immediately before your "if" statement, then the bug is in code we haven't yet been shown. Dave In reply to Re: need helpo regarding regular expression
by davido
|
|