I don't understand why you add '<BR>' when outputting the changed file, if all what you want is to change the one line containing the date, however...

There are two things to consider:

(1) You need to modify an existing file.

The usual approach is that you read the original file, write to a new (modified) file, and (after closing) move the new file over the old one.

Your case is however special, in that you alternatively also could edit the file in-place (since only one character is replaced by a different character). If you want to try this approach, open the file in binmode, read the whole file at once in a variable, do the substitution, go back to the beginning of the file (see the function 'seek') and write back the file.

(2) You need to find the <date> line.

The usual recommendation here is to use a HTML parser. However, if you know for sure that your files have a pretty regular format, which makes it easy to identify the <data> entry, you could use either

- the index function to search for the entry (and use substr to replace the date separators), or

that was just so I knew I could see the files. Didn't mean to confuse - sorry.

Not sure what "binmode" is.

I'll check out davidbj's method first (if I can find the modules to install on my local testbed server - it's on windows machine) and get back to you both. ---------------------------------------------- fdsaadsfdsaf

Usually, line endings are translated when reading and writing files, because Windows uses a two-byte-sequence as line terminator (0x0d0a). If you binmode a file handle immediately after opening the file, this translation is suppressed.

If you want to position in a file at random, it is in general a good idea to put the file handle into binmode.

There *are* cases where this is not strictly necessary, and as far I can see, a line ending translation would not hurt in your particular case. But since I don't know in what other way you will modify your files in the future, I thought it is a good idea to advise you about binmode.