First, may I suggest to annotate your code with comments, and to streamline it a bit, because I found it quite incomprehesible. For instance, if I look at
You first delete all \, | and < from the end and the beginning of $_, and then you erase all < from the whole $_. If you erase all < from $_ anyway, you don't need to do this too for the special cases 'begin' and 'end'. Also, if you want to erase completely certain characters from a string, tr is better readible, so your code would becomes/[\\|<]$//g; s/^[\\|<]//g; s/<//g;
Also I find your question self-contradictory. You asks/[\\|]$//g; s/^[\\|]//g; tr/</d;
But for {LEAD} it doesnot creates the proper tag. ... For {LEAD} it creates the tag
So first you say it does not create the tag, then you say it does create the tag. The problem rather seems to me that it does not create an opening tag for HEADLINE only, or is there still something not correct with LEAD?
You should put into your code various print statements, so that you see what is going on, in particular after your program has encountered HEADLINE for the first time. I would do the same if I had to debug such a program...In reply to Re^5: Delete till end of line to another string
by rovf
in thread Delete till end of line to another string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |