...if regex... $pos = tell(LOG) seek(LOG,0,0) || die "Seek error: $!"; ...process line... truncate(LOG,$pos)