Hi, perl newbie here. I need some help with how to use "kill" properly in perl. I have looked at other forum posts but I wasn't to sure about how to use them in my program.
I have an array called @piddatta which reads in active process numbers from a pid file. I am using a loop in my main program to run through the array and then kill off a process if it meets a certain criteria. I have a variable called $i which i increment as the program is exectuted which is then used to reference the array.
Now if i want to kill off a process, is it right to presume it to be
Im hoping that the above would then look at element equal to $1 in the array and then kill that proceses stored in that array number.
Is this a viable sollution to the problem?
I have an array called @piddatta which reads in active process numbers from a pid file. I am using a loop in my main program to run through the array and then kill off a process if it meets a certain criteria. I have a variable called $i which i increment as the program is exectuted which is then used to reference the array.
Code:
my $i = 0;
@piddata = <FILE>; # the file opens correctly i tested it with
# a print statement.
Now if i want to kill off a process, is it right to presume it to be
Code:
kill $piddata[$i];
Im hoping that the above would then look at element equal to $1 in the array and then kill that proceses stored in that array number.
Is this a viable sollution to the problem?