Not in general. I believe some operating systems / file systems support these kind of actions (when they use a record-based system for storing lines of text instead of using one large stream of bytes), but generally (at least on *nix and windows), the best you can do is write a new file and then move it over the original.
There are some perl modules that do what you describe, but they're generally not very efficient. See Tie::File for an example. For large files, you'd probably be better off using 2 files as described above.