Here a few comments on your code that might help you fix your problem.
- You don't use strict or use warnings
- You don't check the return values from die
- Some of your open calls look a bit complex for what they do, for example the first one could be written open(F1, $template) || die;
- $num = "1" could be written $num = 1
- You seem to assume that your tag can appear anywhere in a line when you're searching for it, but when you replace it you assume that it takes up the whole line. Is this right?
--
<
http://www.dave.org.uk>
European Perl Conference - Sept 22/24 2000, ICA, London
<
http://www.yapc.org/Europe/>