in reply to modifying a text file on Win32

You have a misplaced parenthesis. This line:

open(CONFIG, "+<", "c:\\blah.txt" or die "Can't open blah.txt: $!");

should look like this:

open(CONFIG, "+<", "c:\\blah.txt") or die "Can't open blah.txt: $!";

The   'or die...'   bit is not part of the   open(...).

Update: The suggestion of John M. Dlugosz regarding the regex modifier is also promising (depending on the nature of the data). But /m is the one you want to explore, not /s.

These are often confused:
        /m   allows ^ and $ to match embedded \n
        /s   allows . (dot) to match newlines