in reply to Changing a file?
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
|
|---|