in reply to modifying the search pattern of a file.

Here a few comments on your code that might help you fix your problem.

  1. You don't use strict or use warnings
  2. You don't check the return values from die
  3. 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;
  4. $num = "1" could be written $num = 1
  5. 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/>
  • Comment on Re: modifying the search pattern of a file.