in reply to Mini bash script to perl
A simple way, without any error-handling etc:
system("rm screenlog"); system("tail -n 200 screenlog.0 > screenlog"); [download]
HTH, Rata