in reply to Help required inText manipulation
Your post makes me dizzy. Can you provide a solution for that first?
Where did you get this code?
open(B, ">A.xml") or die("Sorry!");
I'm sorry too. Rather than apologize, why not spit out a meaningful and useful message, or at least print the contents of $!
Next let's look at this:
$_=~s/\s\s//gi; $_=~s/\t//gi; $_=~s/^\n$//gi; $_=~s/\n//gi;
Could you explain why it's a good idea to use case-insensitivity when you're matching whitespace, tabs, and newlines? (Hint: It isn't, and you shouldn't indiscriminately do so.)
After that I just lost interest. But I can say that you should parse XML with an XML parser, not regexps. You'll have a better success rate with less brain cramps if you do. Have a look at XML::Simple, or XML::Twig for starters.
And for heaven's sake, for projects starting in 2011 use lexical filehandles, and three-arg version of open.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help required inText manipulation
by thirilog (Acolyte) on Apr 12, 2011 at 08:46 UTC | |
by davido (Cardinal) on Apr 12, 2011 at 09:24 UTC |