in reply to search and replace pattern inside file not working as expected

How did you determine that your while loop never gets executed?

Also, /[ARTEC]/ likely does not match what you expect it to match, given your input file. See perlre about character classes. Most likely, you wanted /^\[ARTEC\]$/.

Replies are listed 'Best First'.
Re^2: search and replace pattern inside file not working as expected
by matze77 (Friar) on Jan 04, 2010 at 16:19 UTC
    Yes. You are right. It would match any, but not the "string" of the uppercases "ARTEC" which is not what i wanted. I "tested" it by putting print statements into the loops now. It works with the new pattern. But i made another mistake the variable needs to be assigned "globally" outside the while loop or my next if block never gets executed. Any hint? ... How could i declare the variable to work outside the loop my and local wont do ...?


    Thanks
    MH