in reply to kill process when files created...

You seem to count all files in /tmp that have the string 'files' in the name and if you find 3 or more you try to kill tcpdump

I'm guessing here that you wanted to search for 'file' because that's in the name of the logfiles and the 3 should have been a 10. That would work, but other programs might produce a file with 'file' included in the name. For example previous incarnations of your script

To be sure to count only logfiles of tcpdump, you could generate a (large) random number (random so that old tcpdump-logs don't count when you restart the program), put that into the name and search for that.

Also the sleep should be inside the while loop, otherwise your program will use 100% CPU.

#!/bin/perl -w srand(time()^$$); my $number= int(rand(100000000)); system "tcpdump -i bge1 -s0 -w /tmp/file$number.out -C 1 &"; while(true){ sleep 2; @array1 = `ls -1 /tmp | grep $number`; $result=@array1; if ($result > 9){
I also changed ls-l to ls -1 which lists one file per line too, but without the chance that the length of a file is equal to the random number.

I only scimmed over the rest of your code but couldn't find any obvious mistakes there.

EDIT: pc88mxer found another bug, so I corrected that (the missing '&') in the code.