in reply to tail script

Your code uses system twice, which one is not working?

While sed is complex enough that writing that out in Perl may be more work than it is worth, you should consider the two-argument form of system when calling it.

The use of system merely to append a line to a file sticks out, however. I suggest using open instead:

open LIST, '>>', '/opt/btb_webservice/ver3/lease_list.txt' or die "/op +t/btb_webservice/ver3/lease_list.txt: $!"; print LIST join(' ',$date,$client_ip,$client_mac,$master_ip),"\n" or d +ie "/opt/btb_webservice/ver3/lease_list.txt: $!"; close LIST or die "/opt/btb_webservice/ver3/lease_list.txt: $!";