> Here are a few caveats:
> I don't need a temp file.

Yes, you do.

> I am unconcerned with overwriting the username.txt file with itself.

Ok, you still need a tempfile.

Now, if you say you are unconcerned with losing all the data in your 
file, then you don't need a tempfile.

The bottom line is this: you don't replace anything in a file.  Instead, 
you read in the original file, and write out the altered lines to a new 
file.  When you are done, you can delete the original file and rename 
the new file to the old file name.

-- 
Posted via http://www.ruby-forum.com/.