in reply to Editing Files In Place


I may be missing some additional context but editing the file in-place seems to be an overly complicated way of adding a new username. Your code and comments suggest that what is really required is to append to the file.

In which case you could do something like the following (see also perlopentut):

open(FETCHMAILRC, '>> .fetchmailrc') or die "Unable to open FMRC." +; print FETCHMAILRC $username, "\n";

If you really need to edit the file in-place then you can use the -i command line option or $^I, as demonstrated so elegantly by merlyn.

--
John.