If it's an option, I'd say rewrite the logging portion of your program to use
Tie::File. Then you could just maintain the
tied array at 100 elements and your logfile would automagically be what you wanted.
Caution: Contents may have been coded under pressure.