in reply to Insert at regular increments

You did not mention anything about portability, but having been involved in this recently, I want to help fellow monks avoid this pitfall.

Probably you want to avoid the local concept of a "line terminator" causing you trouble. So whenever you need to deal with things like this, use binmode. This will prevent Perl from stripping or altering the line breaks when you're on a different system from the one used to create the file in the first place.

Regards.