in reply to Changing a file?

Like dmmiller2k, I'm not too sure what you're trying to do. If you need to read and write from the file, you can open it in r/w mode by adding a "+" before the file name in your open statement.

For example:

$ perl -e'open(X,"+>x.x") or die "cannot open x.x, error $!\n"; print +X "Hi Mike!\n"; seek X,0,0; print X "No";' $ cat x.x No Mike!

Note the "+>" before the x.x filename. That means "open it for output, but allow read and write". That would clobber an existing file.

If you want to r/w a file that's already there, use "+<".

The "seek" command moves the current position back and forth in the file, "pointing" to where you want to read or write from next. You should have a seek any time you switch from reading to writing.

Hope this helps!
--
Mike